I have the following string fragments where I want to match the contents of the key attribute and replace all it's occurrences with ***:
name="prefix1 - key_string suffix1" displayName="prefix1 - key_string suffix2" key="key_string" name2="prefix2 - key_string suffix1" desc="prefix1 - key_string suffix1"
I can easily match the attribute value key_string with something like (?<=key=")\b([^"]+) and replace it with *** so it will read like key="***", but can't seem to figure out how to replace other key_string occurrences using backreference.
Is it possible or do I need to split this into 2 regex passes: 1 to get the match result and another to replace the occurrences of match result?