I need to perform many repetitious modifications to a SoapUI project and was attempting to use regex within jEdit to perform a bulk edit. I know that this method is lazy and regex is not well suited for parsing XML but was I hoping to get advice on the regex I'm using (which I presume is being compiled into a Java Pattern) for a quick win.
This pattern seems to identify the tag I'm interested in.
<tag[\s\S]*?</tag>
This pattern performs the same job as the former.
<tag[\s\S]*?[\s\S]*?</tag>
This pattern suddenly starts matching across tag boundaries picking up way more than intended.
<tag[\s\S]*?string of interest[\s\S]*?</tag>
The purpose of the reluctant modifies (?) on the "multi-line patterns" ([\s\S]*) are meant to limit what is matched to be within a single XML tag element. Am I asking too much of Java's regex Pattern? Or is there a reasonable explanation for why adding content between two reluctant patterns suddenly expands the matched string? And is there a modification to the pattern that will achieve the goal of limiting matches to within a single XML tag?