Uncategorized

mysql: delete records with special characters

 

 

DELETE
FROM
   [table]
where
   First_Name REGEXP '[^a-zA-Z0-9- ]'
   OR Last_Name REGEXP '[^a-zA-Z0-9- ]'
   OR Company REGEXP '[^a-zA-Z0-9-& ]'
   OR website NOT REGEXP '^(https?://|www\\.)[\.A-Za-z0-9\-]+\\.[a-zA-Z]{2,4}'
   OR Email NOT REGEXP '^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$';

Leave a Reply

Your email address will not be published. Required fields are marked *