Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
would become$string = "<img src=\"test.jpg\"> highlight the word 'word' in this se +ntence";
but:<img src="test.jpg"> highlight the <b>WORD</b> '<b>WORD</b>' in this s +entence
would become$string "<img src=\"test.jpg\"> highlight the word <img src=\"word.jpg +\">";
Note that the word word in the photo name did not get <b> tags around it.<img src="test.jpg"> highlight the <b>WORD</b> <img src="word.jpg">;
which obviously is replacing all occurances, inside tags or not. What am I missing?$replacementString = "<b>WORD</b>"; $string =~ s/word/$replacementString/ig;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Replacing text NOT in an HTML tag
by Joost (Canon) on Aug 19, 2005 at 18:32 UTC | |
|
Re: Replacing text NOT in an HTML tag
by wfsp (Abbot) on Aug 19, 2005 at 18:42 UTC |