1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SQL query to find all email addresses before @ that have more than three periods

Discussion in 'General PHP and MySQL Discussions' started by BamaStangGuy, Apr 17, 2014.

  1. BamaStangGuy

    BamaStangGuy Well-Known Member

    Would like to be able to run an sql query against my databases where the email address has more than three periods before the @ part of the email address.
     
  2. HWS

    HWS Well-Known Member

    SELECT email from xf_user WHERE email LIKE '%.%.%.%@%'

    will return all emails with 3 or more dots before the @.
    (edited missing %)
     
  3. BamaStangGuy

    BamaStangGuy Well-Known Member

    Doesn't work against this email: k.i.d.i.e.mu@gmail.com
     
  4. HWS

    HWS Well-Known Member

    Ah, sorry, should be:

    SELECT email from xf_user WHERE email LIKE '%.%.%.%@%'
     
  5. BamaStangGuy

    BamaStangGuy Well-Known Member

    Thanks that worked.
     

Share This Page