Anyone know why these two regexes give different results when trying to match either '//' or '$'? (Python 3.6.4)
(a)(//|$): Matches both 'a' and 'a//'(a)(//)|($): Matches 'a//' but not 'a'
>>> at = re.compile('(a)(//|$)') >>> m = at.match('a') >>> m <_sre.SRE_Match object; span=(0, 1), match='a'> >>> m = at.match('a//') >>> m <_sre.SRE_Match object; span=(0, 3), match='a//'> >>> vs
>>> at = re.compile('(a)(//)|($)') >>> m = at.match('a//') >>> m <_sre.SRE_Match object; span=(0, 3), match='a//'> >>> m = at.match('a') >>> m >>> type(m) <class 'NoneType'> >>>