-
-
Save JeffersGlass/6f8fa6e05b189f367cef34b186a5cf1e 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
import re | |
# . matches any character | |
# * 0 or more of previous character | |
# + 1 or more of previous character | |
# ? 0 or 1 of previous character | |
sentence = '''The panda band in the stand is grand, but | |
the andromeda sand island is pretty bland. Their brand is | |
sandals, you understand, and the lowland androids stan an | |
downland.''' | |
pattern = re.compile(r'\s\wand') | |
for match in re.finditer(pattern, sentence): | |
print(match) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment