Skip to content

Matching lone surrogates *only* #28

@mathiasbynens

Description

@mathiasbynens

See mathiasbynens/regexpu#16 and https://gist.github.com/mathiasbynens/bbe7f870208abcfec860.

var set = regenerate()
  .addRange(0xD800, 0xDBFF) // lone high surrogates
  .addRange(0xDC00, 0xDFFF); // lone low surrogates

var match = '𝌆'.match(RegExp('(' + set.toString() + ')'));
console.log(match == null);
// expected: true
// actual: false, since the surrogate halves are matched

Instead, it would make more sense to match lone surrogates only in such cases.

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