November 2017
Beginner to intermediate
204 pages
5h 23m
English
It is possible to match a range of characters instead of just one. This can add some flexibility to the pattern:
....lower_case_letter = re.compile("[a-z]")if lower_case_letter.search("a"): print("'a' is a match")if lower_case_letter.search("B"): print("'B' is a match")if lower_case_letter.search("123 A B 2"): print("'123 A B 2' is a match")digit = re.compile("[0-9]")if digit.search("1"): print("'a' is a match")if digit.search("342"): print("'a' is a match")if digit.search("asdf abcd"): print("'a' is a match")
Read now
Unlock full access