I'm learning PHP regular expressions, and I came across something I'm having trouble making sense of.
The book gives this example in validating an e-mail address.
if (ereg("^[^@]+@([a-z0-9\-]+\.)+[a-z]{2,4}$", $email))
I'm not clear on a couple elements of this expression.
- what does this mean
[^@]+@
- What is the purpose of the parentheses in
([a-z0-9\-]+\.)
?