I recently got an answer to a question:
Consecutive Regex
But now I want to match only if there is an @ symbol in there.
The original regex is:
(?!.*([._%+-])\1)[A-Za-z0-9._%+-]+
So I tried:
(?!.*([._%+-])\1)[A-Za-z0-9._%+-]+@(?!.*([._%+-])\1)[A-Za-z0-9._%+-]+
But this doesn’t allow any of my special chars to follow the @ symbol.
For instance, the above matches +foo.bar+-test+@m but not +foo.bar+-test+@m+
Any ideas of what I’m doing wrong here?
1 Answer