Created
January 23, 2013 19:58
-
-
Save treystout/4612305 to your computer and use it in GitHub Desktop.
the actual regex is wrong (only matches first char), but it does load and compile
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
604 19:56:24 vagrant@trey-vagrant [~/real_outland] J:0 (outland_env) [back_to_sql] ⎆ cat regex.yaml | |
regex: '[a-z0-9\.-_]' | |
605 19:56:28 vagrant@trey-vagrant [~/real_outland] J:0 (outland_env) [back_to_sql] ⎆ bpython | |
>>> import re, yaml | |
>>> y = yaml.load(open('regex.yaml')) | |
>>> y | |
{'regex': '[a-z0-9\\.-_]'} | |
>>> r = re.compile(y['regex']) | |
>>> r.match('trey') | |
<_sre.SRE_Match object at 0x21a2d98> | |
>>> r.match('special$') | |
<_sre.SRE_Match object at 0x23a2578> | |
>>> r.match('#derp') | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment