Last active
March 17, 2019 19:58
-
-
Save corneliouzbett/735fcdaad7a443cd90812f340a827a0c 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
#A RegEx, or Regular Expression, is a sequence of characters that forms a search pattern. | |
# RegEx can be used to check if a string contains the specified search pattern | |
import re | |
text = "The above code is for dummies like you" | |
# Check if the string starts with "The" and ends with "Spain": | |
x = re.search("^The.*code$", text) | |
if (x): | |
print("Yes we have a match") | |
else | |
print("Don't have a match") | |
# output = Don't have a match |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment