Created
June 8, 2012 19:48
-
-
Save glesica/2897794 to your computer and use it in GitHub Desktop.
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
>>> a = re.compile(r'^[0-9_]+|\W|[_]+$') | |
>>> a.findall('__hello world') | |
['__', ' '] | |
>>> a.sub('', '[email protected]_table name hello') | |
'usernamegmailcom_tablenamehello' | |
>>> a.sub('', 'a') | |
'a' | |
>>> a.sub('', '_') | |
'' | |
>>> a.sub('', '0') | |
'' | |
>>> b = re.compile(r'\W') | |
>>> b.sub('', '[email protected]_table name hello') | |
'__usernamegmailcom_tablenamehello' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment