So I know in JavaScript an implementation is allowed to extend the regular expressions grammar:
An implementation may extend the ECMAScript Regular Expression grammar defined in 21.2.1, but it must not extend the RegularExpressionBody and RegularExpressionFlags productions defined below or the productions used by these productions.
Was this ability ever used? Do any existing JavaScript implementations extend the regular expressions grammar?
ECMAScript Regex is interpreted as any character, if you want it interpreted as a dot character normally required mark \ ahead. // Regex pattern describe any character. let regex1 = /./ ; // Regex pattern describe a dot character.
Syntax for creating a RegExp object: 1. var txt=new RegExp(pattern,attributes);
Using Regular Expressions with JavaScript. JavaScript's regular expression flavor is part of the ECMA-262 standard for the language.
There is a difference between Java and JavaScript regex flavors: JS does not support lookbehind. A tabulation of differences between regex flavors can be found on Wikipedia. However, this does not apply to your case. I surmise that your JS test string has spurious characters, eg.
Yes, Mozilla's Gecko engine did support the sticky y
flag, which was not part of ES5. It did eventually became part of ES6.
This ability may be utilised again when engines start implementing look-behind (I hope they start experimenting before it will get specced).
This is not an exhaustive list, just what first came to my mind. There may be other examples.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With