Skip to content

Whitespace in enclosed tokens #6

@slevithan

Description

@slevithan

Whitespace in character classes is mentioned in the proposal, but how should flag x handle whitespace in other enclosed tokens: {…}, \p{…}, \P{…}, \u{…}, [\q{…}], (?<…>), \k<…>.

Prior art is generally the following:

  • Whitespace in an interval quantifier ({ …}, {… ,}, etc.) leads to { matching a literal {. Presumably this wouldn't be the case in ECMAScript with flag u or v, and I'm assuming whitespace with flag x would not be allowed.
  • \p{…} and \P{…} allow insignificant whitespace (per Unicode recommendations) even without flag x. Not so in ECMAScript, which is stricter, and I'm assuming this would not be relaxed with flag x.
  • \u{…} is not common in other regex flavors, but some have equivalent \x{…}, and I believe they make it an error to add whitespace even with flag x.
  • [\q{…}] is unique to ECMAScript AFAIK, but I assume it would allow insignificant whitespace with flag x.
  • (?<…>) and \k<…> do not allow whitespace, even with flag x.

I'm assuming things like \u {…}, ( ?:…) and (? :…) would be errors even with flag x, and that \0 0 would be equivalent to \0(?:)0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions