in reply to Re: Help using HTML::Parser
in thread Help using HTML::Parser

Ovid, Thanks for your response. To answer your questions, 1)I would want the substitution if I had "fo<some 200K length Tag>o", but NOT if I had fo<some tag>q<some tag>o. 2)I would also want "fools" to become "<bar>foo</bar>" The only reason the code you supplied would not work for me is that it would not do the substitution on "fo<some 200K length Tag>o" I would prefer it, if I were able to do:
while (my $token = $p->get_token ) { ..... if ($token->is_text) { $text .= $token->return_text; } } $text =~ s/foo/<bar>foo</bar>/g;
That's where I get stuck because I see no way to "merge" my "new" document that contains only <bar> tags AND the original text with the original document, which contained the original text and all the other tags. Hope that clarifies.