Skip to content

Instantly share code, notes, and snippets.

@iainireland
Created April 29, 2020 20:58
Show Gist options
  • Save iainireland/b4c9f19fe7ad893140f2b52202826549 to your computer and use it in GitHub Desktop.
Save iainireland/b4c9f19fe7ad893140f2b52202826549 to your computer and use it in GitHub Desktop.
As of Firefox 78, we will ship an updated version of the regexp engine, which will support dotAll, unicode property escapes, and lookbehind assertions.
Use case:
The dotAll flag allows `.` in regular expressions to match any character, including newlines.
Unicode property escapes can be used to match characters according to certain Unicode properties. For example, `/^\p{Decimal_Number}+$/u.test('๐Ÿ๐Ÿ๐Ÿ‘๐Ÿœ๐Ÿ๐Ÿž๐Ÿฉ๐Ÿช๐Ÿซ๐Ÿฌ๐Ÿญ๐Ÿฎ๐Ÿฏ๐Ÿบ๐Ÿป๐Ÿผ') === true`.
Lookbehind assertions can be used to make sure that a pattern is or is not preceded by another (just as lookahead assertions can be used to make that a pattern is or is not succeeded by another).
All three of these features were added to the standard in ES2018. They are becoming a webcompat issue. It is important to get them landed in time for ESR78.
Bug:
Meta bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1367105
Bug to enable by default: https://bugzilla.mozilla.org/show_bug.cgi?id=1634135
Standard:
https://github.com/tc39/proposal-regexp-dotall-flag
https://github.com/tc39/proposal-regexp-unicode-property-escapes
https://github.com/tc39/proposal-regexp-lookbehind
Platform coverage:
All, no pref
DevTools bug:
N/A
Other browsers:
dotAll:
V8 shipping in 62 <https://bugs.chromium.org/p/v8/issues/detail?id=6172>
JSC shipping in Safari Technology Preview 39a <https://bugs.webkit.org/show_bug.cgi?id=172634>
Unicode property escapes:
V8 shipping in 64 <https://bugs.chromium.org/p/v8/issues/detail?id=4743>
JSC shipping in Safari Technology Preview 42 <https://developer.apple.com/safari/technology-preview/release-notes/>
Lookbehind assertions:
V8 shipping in 62 <https://bugs.chromium.org/p/v8/issues/detail?id=4545>
JSC tracking issue: https://bugs.webkit.org/show_bug.cgi?id=174931
Testing:
There are test262 tests covering these features:
https://github.com/tc39/test262/tree/master/test/built-ins/RegExp/lookBehind
https://github.com/tc39/test262/tree/master/test/built-ins/RegExp/dotall
https://github.com/tc39/test262/tree/master/test/built-ins/RegExp/property-escapes
Secure contexts:
This is a JS language feature and is therefore present in all contexts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment