I'm trying to hide domain part of emails in my views when a user tries to reset the password, I'm using gsub but I'm having a problem with the union of 2 characters.
example:
"myemail@example.com".gsub(/.{0,4}@/,'####@')
I got this result:
"my###\#@example.com"
I don't wanna that \ in the middle of the ##, I entered the console and if I just write '#@'
I got "\#@"
, I don't know how to escape these characters.
with this method i also have a problem, if the domain is less then 4 letters i still put 4 '#'s in the domain. But my primary concern is about the junction of '#@'.