If zero or more characters at the beginning ofstring match this regular expression, return a correspondingMatchObject instance. ReturnNone if the string does not match the pattern; note that this is different from a zero-length match.Note:If you want to locate a match anywhere instring, usesearch() instead.
The optional second parameterpos gives an index in the string where the search is to start; it defaults to0. This is not completely equivalent to slicing the string; the'^' pattern character matches at the real beginning of the string and at positions just after a newline, but not necessarily at the index where the search is to start.
The optional parameterendpos limits how far the string will be searched; it will be as if the string isendpos characters long, so only the characters frompos toendpos - 1 will be searched for a match. Ifendpos is less thanpos, no match will be found, otherwise, ifrx is a compiled regular expression object,rx.match(string, 0, 50) is equivalent torx.match(string[:50], 0).