talexb is right - you really should be using HTML::Parser for the majority of this thing - a quicky example :
#!/usr/bin/perl -w use strict; use HTML::Parser; my $tagged_string = "<string>text<other tag>more text...\nstring</stri +ng>another string<string tag>"; my $replace = 'string'; my $parser = HTML::Parser->new(api_version => 3, default_h => [sub {print shift}, 'text' +], text_h => [\&text, 'dtext']); $parser->parse($tagged_string); sub text { my ( $text ) = @_; $text =~ s%\b($replace)\b%<b>$1</b>%sg; print $text; }
/J\
In reply to Re: Reg Expr help
by gellyfish
in thread Reg Expr help
by csotzing
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |