our $ul_or_ol; local $ul_or_ol = qr{ (?: <ul \b (?: (??{ $ul_or_ol }) | (?! </ul \b ). )* </ul \b [^>]* > | <ol \b (?: (??{ $ul_or_ol }) | (?! </ol \b ). )* </ol \b [^>]* > ) }xi; my $re = qr{ <li \b [^>]* > <span class="[^"]+"> [^<]+ </span> ( (?: $ul_or_ol | (?! < (?:li|/li|/ol|/ul) \b ). )* ) (?: </li \b [^>]* > | (?= < (?:li|/ol|/ul) \b ) ) }xi;
Untested.
Update: Fixed to handle nested lists in the "MATCH HERE" portion.
In reply to Re: simple regex help
by ikegami
in thread simple regex help
by nmerriweather
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |