Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
1) Parse a string variable $doc which contains the contents of a html file
2) Do a global substitution on the entire text portion (ie the portion not enclosed in tags), so that I can add additional tags to it.
For example, if I want to enclose every instance of foo, regardless of whether or not it is interrupted with a tag, with a bar tag, and $str = 'FOOFO<FOO>Oxxx' I would want the resulting $str to be $str = '<BAR>FOO</BAR><BAR>FO<FOO>O</BAR>xxx'
Could anyone give me a code sample of how to go about this? Thanks
update (broquaint): added formatting + <code> tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help using HTML::Parser
by Ovid (Cardinal) on Nov 05, 2002 at 23:26 UTC | |
by Anonymous Monk on Nov 06, 2002 at 14:49 UTC |