Mike Mapsnac wrote:

Hello

I found this function online and want to understand how it works.
I don't understand "/^" and "$/". I know that "^" beginning of the string but what is "/^".


Thanks

function validEmail($email)
{
return preg_match("/^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+[a-zA-Z0-9_-]$/",$email);


}

_________________________________________________________________
Fast. Reliable. Get MSN 9 Dial-up - 3 months for the price of 1! (Limited-time Offer) http://click.atdmt.com/AVE/go/onm00200361ave/direct/01/

The / characters are the regex delimiters. This is a throwback to the Perl language. Basically, the / show where the beginning and end of the regex is. You *MUST* have them. After the last / you can put modifiers such as 'i' for case insensitive matching.


You can also use other chars for delimiters, but I try to stick with / for consistency.

--
paperCrane <Justin Patrin>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to