|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
|||
|
|||
|
Hi, I have a table of user inputed e-mails and a lot of them haven't put correct e-mails in. When I use the
mail(email, blah, blah); command and loop through all of them, it stops on some of them giving me errors. How would I either: 1. Bypass it so that it doesn't stop on false e-mails 2. Clean up the table and remove e-mails that will stop it. When i try to run the command "select email from users where email = '%@%';" I get an empty set, even though there are over 500 e-mails in there. Can someone tell me what an e-mail address requires to be processed correctly? Also, why isn't the wildcard working? Is my syntax correct? Thanks. Decius Undergrounds.com - Free Model and Actress Picture Resource http://www.undergrounds.com/ ----------------------------------------- Over 6000 pictures for over 150 beautiful women. Including actresses, models, and singers, our oceanic galleries are all alphabetically filled with high quality images. |
|
#2
|
|||
|
|||
|
You must use LIKE not = when using wildcards. Also, I'd recommend using this pattern "%@%.%"
That should stop mail() from complaining, even if the address isn't valid. |
|
#3
|
|||
|
|||
|
Here's a select that gets all valid (syntactically) email addresses from your table. Whether or not they actually exist, that's another matter....
select * from table where email regexp '([_.0-9a-z-]+@)([0-9a-z][0-9a-z-]+.)+([a-z]{2,3})'; |
|
#4
|
|||
|
|||
|
Thanks. :-)
Works like a charm. One question Kyuzo... Your select statement allows email addresses such as blah@blah to be passed, without a .com etc. Is this your intention? Or should I configure it so that it checks for a .com too? Thanks. |
|
#5
|
|||
|
|||
|
Decius,
Are you sure about that??? I changed an email in one of my tables to blah@blah ;-) and the select statement didn't pull it out. The final part of the regular expression ( the .)+([a-z]{2,3})'; stuff...) should check for a .com, .org, .net, .jp, .de, dot just about anything. Give it a shot again and let me know if it doesn't work -- I'll be surprised if it doesn't.... Regards, Kyuzo |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > E-mail clean ups - Wildcards and more |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|