I have a string 'test@gmail.com'
I want to use regex for replace all characters before @ to star(*)
So expected result:
'****@gmail.com'
I tried to use a regexp like this:
'test@gmail.com'.gsub(/^.*?(?=@)/, '*') but the result is *@gmail.com
or regexp like this:
'test@gmail.com'.gsub(/^[^@]*/, '*') but result is the same *@gmail.com
I don't want to use the .split method
May you give some advice please?