Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Steven Levithan edited this page · 169 revisions
Clone this wiki locally

See version history for released versions.

XRegExp 3.0.0-pre: completed changes

The following changes have been completed and are available via the latest build here on GitHub:

  • New feature: Unicode addons: Added the new flag A (A for "astral"), which opts-in to full 21-bit Unicode support for \p and \P (i.e., code points up to U+10FFFF, rather than the default upper limit of U+FFFF). This extended support applies to all Unicode categories, scripts, blocks, and properties that include astral code points. Flag A also enables support for scripts and blocks that include only astral code points, and disables the use of \p and \P within character classes (a descriptive error is thrown). This is because JavaScript character classes can match code units only, not code points. In astral mode, use e.g. (\p{L}|[0-9_]) rather than [\p{L}0-9_]. Thanks to Mathias Bynens for providing the supporting data. (#25, #29, #33)
  • New feature: Added feature 'astral' to XRegExp.install/uninstall/isInstalled. Running XRegExp.install('astral') implicitly sets the new flag A for all regexes. (#28)
  • New feature: Added function XRegExp.replaceEach for batch replacements. (#20)
  • New feature: Added function XRegExp.match, as a re-implementation of String.prototype.match that gives you the result types you actually want, lets you override flag g and ignore lastIndex, and fixes browser bugs. (#32)
  • New feature: XRegExp-All: Can now be loaded as a RequireJS AMD module that creates no globals. (#38)
  • New feature: XRegExp-All: Can now be imported in Node.js using require('xregexp'), as an alternative to the CommonJS-compatible require('xregexp').XRegExp.
  • New feature: Unicode addons: Single-letter Unicode categories can now be referenced without curly brackets, e.g., \pL or \PL. (#15)
  • New feature: Added the reparse option to the XRegExp.addToken options object, which allows simplified syntax and flag tokens. (#18)
  • New feature: Added the leadChar option to the XRegExp.addToken options object, which can provide a significant performance improvement when applicable.
  • New feature: Added function XRegExp.cache.flush for improved control during performance testing.
  • Fine tuning: Major performance optimization for creating regexes. (Pattern caching, token leadChar checks, #24, etc.)
  • Fine tuning: Major performance optimization for XRegExp.cache. (No string concat)
  • Fine tuning: Major performance optimization for copying regexes with XRegExp and XRegExp.globalize. (Native constructor, #24, etc.)
  • Fine tuning: Major performance optimization for XRegExp.exec/test/replace/forEach/split. (#23, etc.)
  • Fine tuning: Unicode addons: Updated Unicode data from version 6.1.0 to 7.0.0. [Mathias Bynens] (#39, #73)
  • Fine tuning: Unicode addons: Moved character data for Unicode category L (aka Letter) from Unicode Base to Unicode Categories.
  • Fine tuning: Unicode addons: Changed the format for providing Unicode data, via XRegExp.addUnicodeData. (#29)
  • Fine tuning: Replaced XRegExp.addToken's trigger and customFlags options with new flag and optionalFlags options that provide easier-to-use replacements for the same functionality.
  • Fine tuning: Removed the this.hasFlag function previously available within token definition functions. In its place, you can use the new third argument (flags) that is passed into token handler functions.
  • Fine tuning: Using the same name for multiple named capturing groups in a single regex is now a SyntaxError. (#22)
  • Fine tuning: Removed the 'all' shortcut used by XRegExp.install/uninstall. (#27)
  • Fine tuning: XRegExp now overwrites itself when loaded twice, rather than silently skipping the script. (#17)
  • Fine tuning: Explicitly define a global XRegExp object to allow usage in Meteor 0.6.5 and higher. (#55)
  • Fine tuning: Removed 'extensibility' as an installable/uninstallable option, since it did little more than add hassle for addons. The functionality it provided is now always available.
  • Fix: XRegExp.matchRecursive addon: When given valueNames, the value and name properties in results were reversed. (#26)
  • Fix: addon: A trailing unescaped $ in subpattern definitions was stripped even when a leading ^ wasn't present. (#35)
  • Fix: A ReferenceError is now thrown when accessing an unknown backreference via XRegExp.matchChain.
  • Fix: A TypeError is now thrown when XRegExp.replace/split are given a null or undefined subject string, and when String.prototype.replace/split/match are called on null or undefined context when overridden by XRegExp.install('natives') and in ES5 strict mode.
  • Fix: A SyntaxError is now thrown if the reserved words length or __proto__ are used as capture names.
  • Fix: A quantifier now applies to the preceding token when separated by a combination of both inline comments and free-spacing.
  • Fix: In edge cases, XRegExp.cache didn't treat a forward slash in the list of flags as an error.
  • Other: Harmonized the version numbers for XRegExp and its official addons.
  • Other: Removed the BackCompat and Prototypes addons.
  • Other: Converted all QUnit unit tests to Jasmine, and added several thousand new tests.
  • Other: Added performance tests in tests/perf/.
  • Other: Added a .editorconfig file for consistent coding styles between different editors. [Mathias Bynens]

Share your ideas

Open a new issue here on GitHub, or fork the repo and start hacking.

Something went wrong with that request. Please try again.