Page 1 of 1

Nested Regex Targets

Posted: Sat Feb 11, 2006 4:48 pm
by GameMusic
I ran into this problem when making an HTML filter. When searching for HTML tags, how do you handle nesting?

For example, if I search for all HTML tags, <b><i></i></b> is straightforward with ungreedy matching, but <b><i><b></b></i></b> will match the nested closing b tag with the first b tag. To get around this I made a ridiculously complex system with regexes that marked tags with numbers and recursive callbacks. Now I'm making a template system, and need to allow nested template markup, and something that slow isn't an option.

Posted: Sat Feb 11, 2006 4:55 pm
by feyd
the following links may be of interest:
viewtopic.php?t=42897
viewtopic.php?t=26359