faqts : Computers : Programming : Languages : Perl

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

11 of 39 people (28%) answered Yes
Recently 2 of 10 people (20%) answered Yes

Entry

How do I parse nested HTML tags using regexp?
How can I parse nested HTML tags with regular expressions?

Mar 19th, 2001 05:24
Michael Sonnleitner, Steve Lloyd, Per M Knutsen, perl cookbook oreilly


m{
   <b><i>
   [^<]*
   (?:
   (?! </?[ib]> )
   <
   [^<]*
   )*
   </i></b>
}sx
or:
m{ <b><i>( ( ?: (?!</b></i>).)*)</i></b>} sx