Created
January 7, 2016 11:35
-
-
Save DarkMio/5d18859dd6abaaaa7377 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
pattern_lines = """ | |
f 1 2 3 | |
f 1/2 3/4 5/6 | |
f 1//2 3//4 5//6 | |
f 1/2/3 4/5/6 7/8/9 | |
""" | |
for pattern in pattern_lines.splitlines(): | |
if pattern.beginsWith("f"): | |
line_begins_with_f(pattern) | |
def line_begins_with_f(pattern): | |
if pattern.matches("\/\/[\d\.]+\s"): | |
do_something(pattern) | |
continue | |
if pattern.matches("\/[\d\.]+\/"): | |
do_something_else(pattern) | |
continue | |
if pattern.matches("\/[\d\.]+"): | |
do_something_different(pattern) | |
continue | |
do_something_something(pattern) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment