Test/expand my email regex
Posted
by Ross
on Stack Overflow
See other posts from Stack Overflow
or by Ross
Published on 2008-08-30T19:08:02Z
Indexed on
2010/05/28
22:12 UTC
Read the original article
Hit count: 203
I'm really not confident with Regex, I know some basic syntax but not enough to keep me happy.
I'm trying to build a regular expression to check if an email is valid. So far here's what I've got:
[A-Za-z0-9._-]+@[A-Za-z0-9]+.[A-Za-z.]+
It needs to take account of periods in the username/domain and I think it works with multiple TLDs (e.g. co.uk).
I'm working with the preg engine in PHP so it needs to work with that. Thanks if you can help!
© Stack Overflow or respective owner