Hello,
BTW the ^ symbol means "search at the very beginning of the string"
or maybe SELECT * FROM `table_name` WHERE Email REGEXP "(^[a-z0-9]+)\@(.*)
this puts the name in $1 and the domain in $2, if you are running
the select from a perl script -
:-)
Jim
-----Original Message-----
From: Robert Citek [mailto:rwcitek@stripped]
Sent: Tuesday, December 10, 2002 5:44 PM
To: MySQL
Subject: Re: REGEXP email address query
Hello Richard,
At 05:06 PM 12/10/2002 -0800, Richard Baskett wrote:
>SELECT * FROM `table_name` WHERE Email REGEXP "^[@]";
>But I am doing something wrong, because it's just not working :)
You are searching for an Email field that begins with an @.
Some alternatives:
SELECT * FROM `table_name` WHERE Email not REGEXP "@"
SELECT * FROM `table_name` WHERE Email not like "%@%"
For a more detailed discussion, I recommend the book "Mastering Regular
Expressions, 2nd Edition":
http://www.oreilly.com/catalog/regex2
Regards,
- Robert
sql,query
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <mysql-thread127176@stripped>
To unsubscribe, e-mail <mysql-unsubscribe-jim=workinout.com@stripped>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php