Hugo van Kemenade: Soft-deprec... Note

Hugo van Kemenade: Soft-deprecating re.match()

re.match() attempts to match a pattern at the very beginning of a string. It returns a match object if the pattern is found at the start, otherwise it returns None. re.match("pi", "pi") and re.match("pi", "pie") both return a match because "pi" is at the beginning of these strings. However, re.match("pi", "api") and re.match("pi", "magpie") do not match as "pi" does not appear at the string's start.In contrast, re.search() scans the entire string and returns the first location where the pattern is found, regardless of its position. re.fullmatch() requires that the entire string precisely matches the pattern from start to finish. Python 3.15 introduced re.prefixmatch() as an alias for re.match(), aiming for clearer semantics with its name. re.match() has been soft-deprecated in Python 3.15, meaning it should not be used for new code but remains safe for existing code. New code should prefer re.prefixmatch() if the intention is to match only at the beginning.