« March Madness on MSN Search | Main | EMP, RIP? »

March 16, 2005

Balanced Regex Matching in .Net

This one made my head hurt. .Net supports regular expressions that can detect unbalanced parenthesis (long the bane of regular expressions). Actually it's unbalanced anything, here is Ryan's example for angle brackets:

<[^<>]*(((?<Open><)[^<>]*)+((?<Close-Open>>)[^<>]*)+)*(?(Open)(?!))>

.Net has super-hectic regular expression support, but I wasn't aware of this.

Posted by AdamBa at March 16, 2005 04:58 PM

Trackback Pings

TrackBack URL for this entry:
http://proudlyserving.com/cgi-bin/mt-tb.cgi/173

Comments

.NET has super-hectic support for everything, it seems. (Apart, of course, from VB6, but that horse has been flogged far too much. :D) I must confess that I tend to steer clear of regexes -- they may be small and neat, but they're pretty much incomprehensible. If you take your eye off them for a second you'll never remember where you were!

Posted by: Mat Hall at March 21, 2005 07:19 AM