[Mono-list] Regex Nested Constructs

Derek Hamilton derek@capweb.com
Tue, 8 Apr 2003 14:57:53 -0700


Hello,

I was wondering if there were any plans for adding support for .NET Nested
Construct matching to the RegularExpressions library.  For example, if you
want to find paired double-quotes you can do a Regex like so:

Regex r = new
Regex("\"(?>[^\"\"]+|\"(?<DEPTH>)|\"(?<-DEPTH>))*(?(DEPTH)(?!))\"");

It's a bit tricky to read but basically it looks for pairs of *something*.
In this case it's double-qoutes.  A good reference for this is in "Mastering
Regular Expressions" by Jeffrey Friedl, page 430.

This works very well for us doing some text parsing and I'm hoping to be
able to run the program on our linux server instead of my laptop.

Thanks for any help,
Derek Hamilton