Difference between re.search and re.match in python

re.search scan through string looking for the first location where the regular expression pattern produces a match, and return a corresponding match object, while in re.match If zero or more characters at the beginning of string match the regular expression pattern, it return a corresponding match object. Below code snippet will explain the difference.

Categories: Python