Firefox until 78 support `\p`, Is there any good solution?
SCWR opened this issue · 3 comments
What is the issue you've encountered?
You're making some assumptions about browser support here that do not seem relevant. XRegExp has supported \p{...} for matching Unicode categories, etc. for something like 14 years now (before JS regex syntax supported it natively), going back to at least Firefox 3.
For my scenario, I need compatibility with Firefox 67
Then I use the xregexp base ability to do forward matching. That's your example https://gist.github.com/slevithan/2387872
This line is executed when using the XRegexp base capability
Line 1871 in 2dcf16d
However, Firefox needs to be upgraded above 78 to support \p{...}
https://caniuse.com/?search=%5Cp
Whether the above functions are required
If not, is it possible to make a plug-in
Base capabilities are one package, others are loaded on demand
By the way, I solved this problem by tweaking compatible versions
Ah, now I see what you mean. That line you highlighted in xregexp.js gets translated automatically by babel-plugin-transform-xregexp when generating xregexp-all.js. You could modify the build script if you wanted to not include all the plugins while still using Babel to do this transformation. You could also use any XRegExp version prior to v5.0.0 (where this line was added to support an extended set of capture name characters as part of #247) to get around this.
If not, is it possible to make a plug-in
Base capabilities are one package, others are loaded on demand
Yes, I'm open to this and would be happy to see pull requests that show how this might be achieved.
