I have looked at several regex questions on the site but none work, sorry if people feel this repititon. I have this string in an XML file:
<MessageRef>Trading01</MessageRef>
Where Trading01
will be a different String (which needs to be manually input) every time the xml is generated. The objective is to automatically generate any unique value here for testing purposes. How do I remove whatever is between <MessageRef>
and </MessageRef>
?
I have tried this but it is not working:
message.replaceAll("(<MessageRef>)[^&]*(</MessageRef>)", String.valueOf(System.currentTimeMillis()));
It's a simple issue I know but it has been annoying me all morning! Any help will be greatly appreciated!