Skip to content

Issues with \X #38

@slevithan

Description

@slevithan

The output for \X has some issues:

  • When used with target ES2009 or ES2015, it outputs an empty string with no warning.
  • Output for ES2018 ([\P{M}\P{Lm}](?:(?:[\u035C\u0361]\P{M}\p{M}*)|\u200d|\p{M}|\p{Lm}|\p{Emoji_Modifier})*):
    • Should be matched atomically.
    • Doesn't match some emoji correctly (e.g., 🏳️‍🌈 or 👩🏻‍🏫), which is probably among the more common reasons to use \X.
    • It doesn't match \r\n (a very common grapheme) correctly.
    • The specific pattern used seems a bit arbitrary. I understand that it's meant to be an approximation, but I'm not sure what the details are based on. E.g., the inclusion of only U+035C and U+0361 at the position they're at seems arbitrary (unless there's something I'm missing), and also something like 'A\u035CA' should be counted as two graphemes, not one. Etc.

IMO it would be preferable to simplify or otherwise adjust the approximation to something easily understandable/explainable that only has false negatives (rather than a mixture of false positives and negatives).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions