regex

some useful regex

1
2
3
urls = re.findall("http://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+", page)
emails = re.findall("[a-zA-Z0-9+_-.]+@[0-9a-zA-Z][.-0-9a-zA-Z]*.[a-zA-Z]+", page)
ips = re.findall("(?:[d]{1,3}).(?:[d]{1,3}).(?:[d]{1,3}).(?:[d]{1,3})", page)
EmailDiggFacebookDeliciousStumbleUponTwitterTumblrGoogle GmailBlogger PostGoogle ReaderSina WeiboBox.netEvernoteFriendFeedGoogle BookmarksHotmailLiveJournalLinkedInPrintPrintFriendlyRedditSlashdotWordPressShare

Tags: , ,

Monday, August 25th, 2008 python, tech No Comments