Update: This version of XRegExp is outdated. See XRegExp.com for the latest, greatest version.
- Added regex syntax:
- Comprehensive named capture support. (Improved)
- Comment patterns:
- Added regex modifiers (flags):
s(singleline), to make dot match all characters including newlines.
x(extended), for free-spacing and comments.
- Added awesome:
- Reduced cross-browser inconsistencies. (More)
- Recursive-construct parser with regex delimiters. (New)
- An easy way to cache and reuse regex objects. (New)
- The ability to safely embed literal text in your regex patterns. (New)
- A method to add modifiers to existing regex objects.
applymethods, which make generically working with functions and regexes easier. (New)
All of this can be yours for the low, low price of 2.4 KB. Version 0.5 also introduces extensive documentation and code examples.
If you're using a previous version, note that there are a few non-backward compatible changes for the sake of strict ECMA-262 Edition 3 compliance and compatibility with upcoming ECMAScript 4 changes.
XRegExp.overrideNativefunction has been removed, since it is no longer possible to override native constructors in Firefox 3 or ECMAScript 4 (as proposed).
- Named capture syntax has been changed from
(?<name>…), which is the standard in most regex libraries and under consideration for ES4. Named capture is now always available, and does not require the
- Due to cross-browser compatibility issues, previous versions enforced that a leading, unescaped
]within a character class was treated as a literal character, which is how things work in most regex flavors. XRegExp now follows ECMA-262 Edition 3 on this point.
is an empty set and never matches (this is enforced in all browsers).