Basic regex support in S2, with a NFA algorithm supporting capturing groups. This is the Swiss army knife of string manipulation, as far as S2 is concerned.
There's some mini-documentation
here, which is pretty much a must-read right now.
As the code clocks in at just under 1,000 lines of S2, it's a bit big to paste here. So I've distributed it as a "package". Here's how to install it in your layers:
1.
Download the file. Uncompress it using some decompressor that supports .bz2 files (StuffIt Expander on Mac/Windows works, as does WinZip 10).
2. Copy and paste the file at the top of your layout. It will only work in layout layers.
3. If you have any classes in your layout, S2 requires them to be declared before any function declarations. If you have no classes or other packages (usually you don't), you may skip this step. Otherwise, search for the "End of S2 Regex classes" comment. You should see vvvvvv and ^^^^^^ comments. Move your classes and other packages in between these two lines. (I'd like to humbly suggest that this become a "standard" of sorts for future packages. It's the easiest way I could think of.)
The regex package should now be installed, and you'll now have access to the RERegex class. Have fun!