Join Nostr
2024-10-24 22:20:26 UTC

Zuri (he/him) ❌️👑 | 🕐 CET on Nostr: #RegExp experts: Is there a way to have a single regex and a single replacement for a ...

#RegExp experts:

Is there a way to have a single regex and a single replacement for a masking task like this w/o looping or multiple function calls?

johndoe@example.com
?????*+@?????*+.?+
johnd**@examp**.com

1. 1st n chars unmasked
2. Remaining chars until fixed chars masked
3. Fixed chars as is
4. 1st n chars unmasked
5. Remaining chars until fixed chars masked
6. Fixed chars as is
7. Remaining chars unmasked

#regex #regularExpressions #amCoding #amProgramming #webDev #softwareEngineering