Last active
August 29, 2015 14:21
-
-
Save craigsdennis/bb225b54dce29f6c8a36 to your computer and use it in GitHub Desktop.
Regular Expression Example in Python
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 | |
title = "Regular Expressions in 10 different languages" | |
result = re.match(r'.*\d+.*', title) | |
match = re.search(r'(\d+)', title) | |
# This will return None match is not found | |
if (match): | |
print('There are {} languages represented.'.format(match.group(1)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment