Code Snippet Question

I have this code snippet that is part of an e-mail validation:

[php]$email_pattern =
‘/^[^@s]+@([-a-z0-9]+.)+[a-z] {2,}$/i’;[/php]

I don’t understand the purpose of some of the symbols in the second line. Where is the best place to go to get a break down on what it does?

I understand part of it, but the first bracket, the carets, and the curly braces section are confusing to me.

I hate regrex! :slight_smile:

is there a difference between regular expressions and other types?

Regular expressions is pattern matching/manipulating and there are 2 types - PCRE - perl compatable (http://www.php.net/pcre) and POSIX (http://www.php.net/regex). I have been told to stick with PCRE but… shrug.

Oh and the pattern you put up is PCRE. I’ll take a shot at translating your code… I will probably be wrong so be prepared to look it up. :slight_smile:

Edited to show indention
Regular expressions is pattern matching/manipulating and there are 2 types - PCRE - perl compatable (http://www.php.net/pcre) and POSIX (http://www.php.net/regex). I have been told to stick with PCRE but… shrug.

Oh and the pattern you put up is PCRE. I’ll take a shot at translating your code… I will probably be wrong so be prepared to look it up. :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service