I am trying to mask email address in the following different ways.
Mask all characters except first three and the ones follows the @ symbol. This expression works fine.
firstname.lastname@example.org -> email@example.com
Mask all characters except last three before @ symbol.
Example : firstname.lastname@example.org -> *****email@example.com
I am not sure how to check for @ and do reverse match.
Can someone throw pointers on this?
Maybe you could do a positive lookahead:
See the online Demo
.– Any character other than newline.
(?=.*...@)– Positive lookahead for zero or more characters other than newline followed by three characters other than newline and