Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern: clarification on whether leading and trailing delimiters are allowed or required #1478

Open
spacether opened this issue Jan 17, 2024 · 2 comments

Comments

@spacether
Copy link

So the definition of pattern is:

 6.3.3. pattern

The value of this keyword MUST be a string. This string SHOULD be a valid regular expression, according to the ECMA-262 regular expression dialect.
A string instance is considered valid if the regular expression matches the instance successfully. Recall: regular expressions are not implicitly anchored.

Does that include the regex literal delimiter / which means that pattern values must look like /pattern/flags (ECMA-262 15.10 or 7.85) or does it just include the pattern (ECMA-262 15.10.1)?
The spec is unclear because it does not link to a specific section of ECMA-262
Can this be clarified? What is allowed? What is required?

@spacether spacether changed the title Pattern: clarification on whether leading and traling delimiters are allowed or required Pattern: clarification on whether leading and trailing delimiters are allowed or required Jan 17, 2024
@Julian
Copy link
Member

Julian commented Jan 17, 2024

Section 6.4 which is the "global" section on regular expressions does point to ECMA 262 Section 21.2.1 which is a section on just the pattern with no flags, so to my quick reading that seems like the answer is "the spec already says it's just the pattern", but adding a crosslink (from pattern to 6.4, and the same for patternProperties, which reminds the reader of what regular expression in the 262 dialect specifically means) seems like it couldn't hurt.

@spacether
Copy link
Author

Yes, if we could add a link or specify that 262 section 21.2.1 applies in the pattern section in the validation portion of the spec, that would meet my needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants