Java Regex-based string replacement

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. \[code\]<?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">\[/code\]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 \[code\]</order orderGroup="mock"> with </order>, </Customer id="xyz"> with </Customer>\[/code\]Any idea if there is quick Java String based regex I can use for doing such replacements ? Thanks.
 
Back
Top