re.match() should always return a match object, but instead .group(1) will return None. Then we can write one-liners easier without the walrus operator.
The problem is not in re.match but in None being a relatively poor Maybe / Optional (still ways better than C-style `null` of many other languages).
if re.match(...).matched:
if let Some(m) := re.match(...) m.group(1)... m = re.match(...) m.group(1) # TypeError because I haven't unwrapped the Optional
re.match vs re.search
>>> import re >>> pat = re.compile("(A+)|(B+)") >>> m = pat.search("HUBBLE") >>> m.group(1) is None True >>> m.group(2) 'BB' >>> m.group(0) 'BB'