Your best bet, as toolic
suggest, is to use an XML parser. Manually parsing XML is fraught with potential bugs and edge cases. However, assuming your XML is well-formed, you can accomplish this task using Look Around Assertions
. Specifically, if you assume that your text field contains no < characters, you can do it with
This will match and replace any occurence of the letters EM that are followed by any number of non-< characters and then a closing article tag.