Using Java, String and replaceAll I have to replace values of elements that may come with different name spaces:
from
<tns:p>to be replaced</tns:p>
<sss:p>to be replaced</sss:p>
to
<tns:p>replaced</tns:p>
<sss:p>replaced</sss:p>
Could you please, help to find regular expression for this replace?
P.S. The elements may appear more than once in a given string:
<tns:p>to be replaced</tns:p>
<tns:w>not to be replaced</tns:w>
<tns:p>to be replaced</tns:p>
I have a problem with variable name spaces in front of elements. Without them I'd do like this:
str.replaceAll("(?<=<p>)(.*?)(?=</p)", "replacement")