One thing to consider in similar situations such as presented by the OP is to use CSS contextual selectors rather than subject the text to regex.
As I understand, there was a problem with italicized text within forms. A style rule could deal with that instantly:
form em {font-style: normal}
This would un-italicize anything within em tags which are in a form—while ignoring all other em tag content.
|