Good to know. Without doubt, expressions are my weakest area as a programmer.
The same point goes for the backslash that Tom introduced. The backslash is used to revoke any special meaning that so called metacharacters (
<font color='"#A52A2A"'>*</font>, etc.) have, so that their literal characters can be matched. The angle bracket is not special*.
Michael, you don't mention whether the callback function makes any use of the whole match or just the captured group.
Just the captured group.
If the full match isn't used, then there isn't any need to even try to match the closing angle bracket, since it is optional.
Optional yes, but if it's present I want to remove it when the replace occurs. If it where up to me I'd require it for consistency, but for historical reasons (and I can't ask the product department to go back and redo some 30,000 entries) I have to make the expression tolerate the lack of a closing bracket.