I have a string in log and I want to mask values based on regex.
For example:
"email":"[email protected]", "phone":"1111111111", "text":"sample text may contain email [email protected] as well"
The regex should mask
- email value - both inside the string after "email" and "text"
- phone number
Desired output:
"email":"*****", "phone":"*****", "text":"sample text may contain email ***** as well"
What I have been able to do is to mask email and phone individually but not the email id present inside the string after "text".
Regex developed so far:
(?<=\"(?:email|phone)\"[:])(\")([^\"]*)(\")