import re
print("Usage of square bracket : ")
string = "The quick brown fox jumps over the lazy dog"
pattern = "[a-m]"
result = re.findall(pattern, string)
print(result)
pattern = r"^The"
print("\n\n Search the pattern "+pattern+" at the end of the string ")
match = re.search(pattern, string)
if match:
print("Match found!")
else:
print("Match not found.")
No comments:
Post a Comment