Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upIs /l{ 12 , }/ just as valid as /l{12,}/? #639
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
claudepache
Jul 21, 2016
Contributor
Just tested in Firefox and Safari:
/^a{1, }$/.exec('a') // null
/^a{1, }$/.exec('a{1, }') // ["a{1, }"]I.e., /^a{1, }$/ is treated the same way as /^a\{1, \}$/. That semantics is already specced in Annex B (hint: ExtendedPatternCharacter does not exclude { nor }).
|
Just tested in Firefox and Safari: /^a{1, }$/.exec('a') // null
/^a{1, }$/.exec('a{1, }') // ["a{1, }"]I.e., |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
icefapper
commented
Jul 21, 2016
|
@claudepache |
icefapper
closed this
Jul 21, 2016
icefapper
reopened this
Jul 21, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
icefapper
Jul 21, 2016
@claudepache
Please correct me if I'm actually wrong: /a{1, }/ is treated like /a\{1, \}/ because {1, } fails to get parsed as an RE quantifier? I'm asking this because that is what I understand from:
[~U]ExtendedAtom Quantifier
[~U]ExtendedAtom
could I ask if I'm correct?
icefapper
commented
Jul 21, 2016
•
|
@claudepache
could I ask if I'm correct? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
claudepache
Jul 21, 2016
Contributor
@icefapper You're correct. Under the annex-B semantics, when parsing a RegExp pattern, the order under which the production alternatives are tried is significant.
|
@icefapper You're correct. Under the annex-B semantics, when parsing a RegExp pattern, the order under which the production alternatives are tried is significant. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
icefapper
Jul 21, 2016
@claudepache Thanks!
I will leave this issue at your disposal; please close it whenver you find it appropriate.
icefapper
commented
Jul 21, 2016
|
@claudepache Thanks! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
icefapper
Jul 22, 2016
@claudepache Also for the record, Chrome accepts /[\w-e]/ even though I've not come across any matching production for it in the spec.
icefapper
commented
Jul 22, 2016
•
|
@claudepache Also for the record, Chrome accepts |
icefapper commentedJul 21, 2016
•
edited
Hello
From what I understand from the spec, whitespace is significant in literals; which, to me, means
QuantifierPrefix :: { DecimalDigits , DecimalDigits }in RE's should accept/l{12,}/but not/l{ 12 , }/; but that is not the behavior of Firefox, for example; it accepts either of the above.Has the insignificance of whitespace in an RE quantifier been mentioned in the spec? Or is Firefox actually wrong?