Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Email Regex to allow special characters

How can I update the following regex to allow all special characters except "@" in the email handle.

"[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\\.+[a-z._-]+"
like image 836
Amanni Avatar asked Nov 21 '25 13:11

Amanni


1 Answers

You can use:

^[^@]+@[a-zA-Z0-9._-]+\\.+[a-z._-]+$

[^@]+ will match 1 more of anything but @

like image 94
anubhava Avatar answered Nov 23 '25 08:11

anubhava



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!