XRegExp.addToken, fundamentally changes XRegExp's implementation and allows you to easily create your own XRegExp plugins.
Here's XRegExp's abbreviated feature list from the brand new xregexp.com (which includes extensive documentation and code examples):
The full list of changes can be seen in the changelog. Please let me know if you find any bugs or have any suggestions for the library. I'd also love to hear about projects or sites that are using XRegExp (I've got a few listed on the XRegExp homepage now).
Don't forget to pick up a copy of your very own.
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.
apply methods, 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.overrideNative function 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).
Get it while it's hot! Check out the new XRegExp documentation and source code.
1.0 1.1, and updated the documentation in the old post along with it. The new release includes "Z" (US timezone abbreviation) and "o" (UTC offset) flags as well as brevity enhancements from Scott Trenda, along with several other new features including a standalone
dateFormat function, named and default masks (plus you can easily add your own), easier internationalization, etc.
This update includes one change which is not backwards compatible: mask characters and sequences no longer have to comprise entire words for them to be treated specially. The former handling was intended to make it dead-easy to mix literal characters into date masks, but ended up mostly just being a slight nuisance since most people didn't use it to embed dates in larger strings.
Check out the new Date Format!
timeFormat functions, since version 0.1.
RegexPal (easily the most del.icio.used regex tester ) is now released under the
Creative Commons Attribution-Share Alike 3.0 License GNU LGPL.
There are certainly many more features that can be added to the app and things that can be improved, so if you are interested in helping out or creating your own version, you are welcome to do so. If there is interest I'll create a Google Code project, but for now
there is a package you can download which includes all files for the regexpal.com website. Two of the files in the package (xregexp.js and helpers.js) are dual-licensed under the MIT License.
For regex aficionados particularly, there is some stuff here you might find interesting, including the latest, as-yet-unreleased version of my XRegExp library, and the regex syntax parser used for RegexPal's syntax highlighting (which includes lots of details on the minutiae of regex syntax and cross-browser regex handling).