Jan-20-2024, 03:24 AM
(This post was last modified: Jan-20-2024, 03:25 AM by deanhystad.)
You read the documentation?
Quote:re.search(pattern, string, flags=0)search returns None if there is no pattern match. You need to check that search() returned a match before using the match.
Scan through string looking for the first location where the regular expression pattern produces a match, and return a corresponding Match. Return None if no position in the string matches the pattern; note that this is different from finding a zero-length match at some point in the string.