in reply to Regular Expression

use HTML::TokeParser::Simple; my $p = HTML::TokeParser::Simple->new (\*DATA) or die; my $in_small = 0; while (my $token = $p->get_token) { if ($token->is_start_tag('small')) { $in_small++; } elsif ($token->is_end_tag('small')) { $in_small--; } elsif (not $in_small) { print $token->as_is; } } __END__ <html><head><title>hello world</title></head><body> <h1>hello world</h1> Did you know that <small>this is small</small>? </body></html>

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.