|XP is just a number|
Regex look-behind problem.by the_0ne (Pilgrim)
|on Jul 12, 2007 at 21:21 UTC||Need Help??|
the_0ne has asked for the
wisdom of the Perl Monks concerning the following question:
Hey monks, have a regex problem that I'm hoping you can help with.
First off, disclaimer, the reason I am not using an html parser is the format I am going to is not very synonomous with html converters. I'm working with a very small subset, so I'm hoping to bang this out with regexes instead of a full-blown html parser.
Here's the code...
Here's the output I am getting...
Notice the second <bold> is being replaced with <bold-italic>. By the regex (at least I think I have the regex right) the second bold *should not* be replaced since I perform a look-behind for <normal>. If <normal> is between the <italic> and the <bold>, then the <bold> should be left alone. At least this is what I am trying to get at.
Here what I would like to see...
Notice the second <bold> is not replaced.
I'm confused as to what is wrong with my regex.
Thanks again Monks for all your help.