5 ms·
This regexp [^ @]*@[^ @]* will validate strings like `@example.com` and `joe@` and even a single `@`. Probably [^ @]+@[^ @]+ is what he wants, plus
by JoeAcchino 13y ago
This regexp
[^ @]*@[^ @]*
will validate strings like `@example.com` and `joe@` and even a single `@`. Probably
[^ @]+@[^ @]+
is what he wants, plus server side validation (that is the classic "click link to validate address" email).
- daker 13y agoThanks for the suggestion, i will check that :)
- Tautologistics 13y agoForgot the SOL/EOL markers; the above will still match a substring, e.g. xxx@xxx@xxx.com. Try: ^[^ @]+@[^ @]+$ That said, HTML5 has something even better if the input is expected to be an email address: input@type=email See http://www.w3.org/TR/html-markup/input.email.html http://www.w3.org/TR/html-markup/input.email.html for more details.