Search code examples
mysqlemail-validation

How to fix emails containing double dot in domain?


How do I update an email containing a double dot in its domain using raw mysql query?

So I have these emails having this format sample_email@gmail..com and turn it to this sample_email@gmail.com


Solution

  • replace should do the trick:

    UPDATE mytable
    SET    email = REPLACE(email, '..', '.')
    WHERE  email LIKE '%..%'