-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard --

...and then Richard Baskett said...
% 
% Ok finally found the answer after many hours of searching :)  Here is the
% MySQL query that works great!
% 
% SELECT * FROM table_name
% WHERE Email NOT 
% REGEXP "^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}"

Boy, is this convoluted.  Ick :-)

One thing that should be clarified is that

  ^[abc]

looks for 'a' or 'b' or 'c' at (the beginning of the line), while

  [^abc]

looks for (anything except 'a' or 'b' or 'c') at that position, and

  ^[^abc]

looks for (anything except 'a' or 'b' or 'c') at (the beginning of the
line).

Another is that there are 4-char TLDs such as .info which your regexp
does not accept; you'll probably need to change that (and, meanwhile,
something like .xx is probably not a real TLD and so you shouldn't accept
that if you're really trying to ensure valid addresses or at least valid
domains).  If not, not only "badaddre.ss" but even "[EMAIL PROTECTED]" would
be selected, and the latter certainly has the '@' that you've said you
want to exclude from your results.

I don't know the MySQL regexp rules, but are searches case-insensitive
(probably) and is '.' within a character class treated literally (maybe)?

Finally, I am not at all sure that you can't have an email address
beginning with [-_\.] (though I don't have time to test it at the
moment).

Wouldn't something simple like

  ...
  WHERE Email NOT REGEXP ".*@.*"

do the job nicely (if not the 'NOT REGEXP "@"' of another reply)?  It
certainly would be easier to read :-)


% 
% Thanks to all that replied!

HTH & HAND


% 
% Rick


mysql query,
:-D
- -- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE9+zhHGb7uCXufRwARAtDyAJsFeRprjoHpgLcc4f2YEK56ziBDNACeMk2w
gXldQg3pFKLD8B4ovNHFt7Q=
=+ZuC
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to