I am banging my head against this regular expression the whole day.
The task looks simple, I have a number of XML tag names and I must replace (mask) their content.
For example
<Exony_Credit_Card_ID>242394798</Exony_Credit_Card_ID>
Must become
<Exony_Credit_Card_ID>filtered</Exony_Credit_Card_ID>
There are multiple such tags with different names
How do I match any text inside but without matching the tag itself?
EDIT: I should clarify again. Grouping and then using the group to avoid replacing the text inside does not work in my case, because when I add the other tags to the expression, the group number is different for the subsequent matches. For example:
"(<Exony_Credit_Card_ID>).+(</Exony_Credit_Card_ID>)|(<Billing_Postcode>).+(</Billing_Postcode>)"
replaceAll with the string "$1filtered$2"
does not work because when the regex matches Billing_Postcode its groups are 3 and 4 instead of 1 and 2