Created
March 31, 2009 20:00
-
-
Save geemus/88377 to your computer and use it in GitHub Desktop.
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
# Optimized regex for finding urls | |
# Top level domain list from: http://data.iana.org/TLD/tlds-alpha-by-domain.txt | |
/(?:^|\s)(?:http[s]?:\/\/)?(?:www\.)?([-a-zA-Z_\.]*\.(?:a(?:[cdfgilmnoqtuwxz]|e(?:ro)?|r(?:pa)?|s(?:ia)?)|b(?:[abdefghjmnorstvwyz]|i(?:z)?)|c(?:[cdfghiklmnruvxyz]|a(?:t)?|o(?:m|op)?)|d(?:[ejkmoz])|e(?:[cegrstu]|du)|f(?:[ijkmor])|g(?:[abdefghilmnpqrstuwy]|ov)|h(?:[kmnrtu])|i(?:[delmoqrst]|n(?:fo|t)?)|j(?:[emp]|o(?:bs)?)|k(?:[eghimnprwyz])|l(?:[abcikrstuvy])|m(?:[acdeghklmnpqrstvwxyz]|il|o(?:bi)?|u(?:seum)?)|n(?:[cfgilopruz]|a(?:me)?|e(?:t)?)|o(?:m|rg)|p(?:[aefghklmnstwy]|r(?:o)?)|q(?:a)|r(?:[eosuw])|s(?:[abcdeghijklmnortuvyz])|t(?:[cdfghjklmnoptvwz]|el|r(?:avel)?)|u(?:[agksyz])|v(?:[aceginu])|w(?:[fs])|xn--(?:0zwm56d|11b5bs3a9aj6g|80akhbyknj4f|9t4b11yi5a|deba0ad|g6w251d|hgbk6aj7f53bba|hlcj6aya9esc7a|jxalpdlp|kgbechtv|zckzah)|y(?:[etu])|z(?:[amw]))(?:[\/]?|(?:[\/]??[-a-zA-Z_\.\/?=&]*)))(?:[,\!\.\?])?(?:\s|$)/iu |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment