Open DarrenCook opened 4 years ago
@DarrenCook, thanks for reporting the issue with the README.
It should say they were added in ES2018.
Yes, we should add it. I'll appreciate a PR for this, or will update it once reach it.
As to your main question: some things can be compat-transpiled, e.g. named capturing groups. Babel added support for it using regexp-tree at some point. There is also https://github.com/DmitrySoshnikov/babel-plugin-transform-modern-regexp which also has partial support for it (transpiles, and runtime support needs to be added).
Lookbehind assertions is harder to transpiler, but we can continue investigating it.
(My "issue" is documentation correction, and request for documentation clarification.)
The README, under lookbehind assertions is out of date:
It should say they were added in ES2018.
If you wanted to include more detail:
It is supported since Chrome 62, Opera 49, Edge 79, Node since 8 with --harmony flag (or Node 10 without any flags). Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=1225665) say it is being worked on, as of Oct 2019, but no signs of that as of Jan 2020. Safari/Webkit (https://bugs.webkit.org/show_bug.cgi?id=174931) have been ignoring it since July 2017.
My main question: it wasn't clear to me if I could use regexp-tree as a drop-in replacement for ES2018 RegExp (specifically named capture groups and lookbehind assertions) on Firefox and Safari. If it is possible, does anyone have an example, or a link to a blog or tutorial (or github project) showing this? And if impossible, is it possible to make that clearer in the README?
From #5 and #66 I think the answer is that it is impossible; however #27 (and the commits it links to) seem to be saying the opposite?
(My motivation is I don't like having to tell people they have to use Chrome; but in the case of wanting to show a demo on an iPad, even that is not an option.)