import re
pattern="hell(o)*"#zero or more time o
if re.match(pattern,"helloo"):
print("worked")
else:
print("Not work")
pattern="hell(o)*xyz"#zero or more time o
if re.match(pattern,"hellooxyz"):
print("worked")
else:
print("Not work")
pattern="hell(o)+"#one or more time o
if re.match(pattern,"hell"):
print("worked")
else:
print("Not work")
worked worked Not work
0 Comments