Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I wrote a code that goes through files, searching for a pattern in the text that file holds. If its matched, the contents of the file is added to an array. Later every value in the array is printed out. Before it is printed out, though, I'd like to replace the pattern with itself surrounded by the <b> and </b> tags. However, if the pattern is in an HTML tag already, I dont want the bold tags applied to it.
I've tried several times to write a successful regular expression to check if the pattern is within an HTML tag, and if it is not to apply the bold tags to it. I've failed every time though. If anyone could helo me with this, I'd really appreciate it.