Last active
December 12, 2015 09:49
-
-
Save pgeraghty/4754245 to your computer and use it in GitHub Desktop.
Finding emails and URLs in MySQL columns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# contains email address | |
where("column_name REGEXP '[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]@[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]\.[a-zA-Z]{2,4}'").count | |
# contains url | |
where("column_name REGEXP ?", "(https?://|www\\.)[\.A-Za-z0-9\-]+\\.[a-zA-Z]{2,4}").count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment