Created
July 2, 2012 18:56
-
-
Save luztak/3034918 to your computer and use it in GitHub Desktop.
RegEx for [at] and urls.
This file contains 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
import re | |
at_user_filter = re.compile(r'(?:^|\W)@(\w+)') | |
email_filter = re.compile('(\w{1,63})@([A-Za-z0-9\.\-] ).(com|net|org|me|in|fm|co|biz|info|mobi|cc)') | |
#you can add suffixes by asking Google for domain suffix information. | |
url_filter = re.compile(u'((http(s|)|ftp)://|)(\w{0,}\.|)(\w{1,63}).(\w{2,4})((/((.*)|)|))') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
擦,?:这个我还真解释不上来,爪机无力自行百度吧...
mail你歧视了一大片非主流后缀,url我看那re写的太蛋疼就没看...这括号跟lisp似的...