Last active
December 27, 2015 19:39
-
-
Save mattjbarlow/7379139 to your computer and use it in GitHub Desktop.
Trying to match universe multiple times between START and END lines.
This file contains hidden or 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 | |
divine_comedy = """ | |
Test word universe should not match. | |
*** START *** | |
His glory, by whose might all things are mov'd, | |
Pierces the universe, and in one part | |
One more universe. | |
*** END *** | |
""" | |
search = re.compile(r'\*{3} START \*{3}.*(\buniverse\b)', re.IGNORECASE|re.DOTALL) | |
print "Match is: " + re.search(search, divine_comedy).group() | |
print "Groups are: ", re.search(search, divine_comedy).groups() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output I get with this is: