Reputation: 754
I'm trying to figure out how to replace with Java 1.6 in strings like
hello ${world }! ${txt + '_t'}<br/> ${do_not_replace
any substring identified between '${' and '}' with the same substring without these delimiters. So the output for the string above should be
hello world ! txt + '_t'<br/> ${do_not_replace
I identified a working pattern that allows me to replace the substrings with a fixed string
str.replaceAll('[${](.*?)}', '_')
and i know that i cannot use named groups with this version of Java.
Any suggestion for a simple solution to this problem are highly appreciated! Many thanks
Upvotes: 1
Views: 882