With this RegExp I can easily check if an email is valid or not:
RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
However, this just return true for such addresses:
example@example.com
I also want to accept:
*@example.com
What changes I need to apply on my RegExp?
Thanks in advance
A couple of things: to accept
*@foo.bar:But this expression does accept
-@-.--, but then again, regex and email aren’t all too good a friends. But based on your expression, here’s a slightly less unreliable version:There is an expression that validates all valid types of email addresses, somewhere on the net, though. Look into that, to see why regex validating is almost always going to either exclude valid input or be too forgiving