I have a requirement as part of which i need to replace all the alphanumeric chars in a string except first 3 chars with X.
Example:
123 wer –> 123 XXX
[email protected] –> [email protected]
I tried to come up with regex (
Regex –> (?<=^…)(.*)
) that does match all chars except first 3 but it replaces rest characters with single X like below:
123 wer –> 123X
[email protected] –> helX
Can someone please guide on the right regex to use?
You may use this regex for matching:
(?<=.{3})([^p{L}dn]*)[p{L}d]
and replace it with:
$1X
RegEx Demo