Results 1 to 17 of 17
Threaded View
-
02-11-2005, 05:38 AM #1New Member
- Join Date
- Feb 2005
- Posts
- 2
Help with validating emailadress (preg_match)
Hi,
I am trying to validate an emailadress, so that you enter a valid email. I am using this script:
PHP Code:$email = 'user@domain.com';
if (preg_match("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$^", $email)) {
echo 'Email is correct!';
}
I realize that the [_a-z0-9-] is the valid chars, but how about the other things? Like the ^ at the beginning, and what difference does the + and the * make between them blocks?
Anyway, i would truly love it if someone would try to explain this to me. Thanks!
Hugs / Merilille