>>> preg_match("/^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+[a-zA-Z0-9_-]$/",$email); >> >> 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. > >I think he meant.. the carrot after the delimiter which means NOT.. like >/[^a]/ means match anything thats not an 'a'
In the case above, the caret means the beginning of a pattern. It only negates a pattern in the "[]" context: "/^a/" means an 'a' at the beginning of the pattern "/[^a]/" means a char that is not an 'a' "/^[^a]/" means a char that is not an 'a' at the beginning of a pattern FYI, the O'reilly "Learning Perl" book has the best introduction to perl regexp's I've seen yet; I still use it as an indispensable reference. --------------------------------------------------------------------- michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php