Looking for a regex based String replacement in Java on the below use-case. I'm doing some Groovy based XML processing and due to some custom processing (won't go much in detail on this), the resulting XML has some invalid tags, for e.g.
<?xml version='1.0' encoding='UTF-8'?>
<Customer id="xyz" xmlns='http://abc.com'>
<order orderGroup="mock">
<entry>
<key>test</key>
</entry>
</order orderGroup="mock">
</Customer id="xyz">
If you note, the end tags of the element names containing attributes are messed up. The XML is just treated as a string, so what I want to do is, just replace occurrences of such end tags via string regex based replacements. For e.g. replace
</order orderGroup="mock"> with </order>,
</Customer id="xyz"> with </Customer>
Any idea if there is quick Java String based regex I can use for doing such replacements ?
Thanks.