After 3+ years, XRegExp 3.0.0 has been released. Standout features are dramatically better performance (many common operations are 2x to 50x faster) and support for full 21-bit Unicode (thanks to Mathias Bynens). I’ve also just finished updating all the documentation on xregexp.com so go check that out. 🙂
lastIndex or slicing strings when tokenizing.
Version 3.0.0 has lots of additional features, options, fine tuning, cross-browser fixes, some new simplified syntax, and thousands of new tests. And it still supports all the browsers. Check out the long list of changes. There are a few minor breaking changes that shouldn’t affect most people and have easy workarounds. I’ve listed them all below, but see the full changelog if you need more details about them.
XRegExp.forEachno longer accepts or returns its context. Use binding with the provided callback instead.
- Moved character data for Unicode category
Letter) from Unicode Base to Unicode Categories. This has no effect if you’re already using Unicode Categories or XRegExp-All.
- Using the same name for multiple named capturing groups in a single regex is now a
- Removed the
'all'shortcut used by
- Removed the Prototypes addon, which added methods
XRegExp.prototype. These were all just aliases of methods on the
- A few changes affect custom addons only: changed the format for providing custom Unicode data, replaced
customFlagsoptions with new
optionalFlagsoptions, and removed the
this.hasFlagfunction previously available within token definition functions.
You can download the new release on GitHub or install via npm. I’d love to hear feedback and common regex-related use cases that you think could be simplified via new XRegExp features. Let me know here or in GitHub issues. Thanks!
2 thoughts on “XRegExp 3.0.0!”
Just started having a look at v3.1.1.
Isn’t it possible to load xregexp and only a few addons without using NPM, Node.js nor RequireJS ?
I’m looking for a nodeJS module that would run regexes but that would limit the number of tries (in case of catastrophic backtracking). I don’t know if something like this exists in NodeJS like it exists in other languages.
Please let me know if you know something!