Why Does JavaScript RegExp Lack The "s" Flag?
Solution 1:
There was no big logic to it, it just wasn't included, like lots of other regex features other environments have that JavaScript doesn't (so far).
It's in the process of being added now. Currently Stage 3, so maybe ES2018, maybe not Stage 4 as of Dec 2017 so will be in ES2018, but odds are high and you'll see support being added to cutting-edge browsers this year ASAP.
(Look-behind and unicode property escapes are also on the cards...)
Side note:
When I run this on regex101.com they support the
s
flag...
Not if you set the regex type to JavaScript via the menu. Click the menu button in the top left:
...and change the "flavor" to JavaScript:
You probably left it on its default, which is PCRE, which does indeed support the s
flag.
They used to make this more obvious. Since they hid it away on a menu, you're not remotely the first person I've seen not have it set right...
Post a Comment for "Why Does JavaScript RegExp Lack The "s" Flag?"