Retrieving python 3.6 handling of re.sub() with zero length matches in python 3.7
问题 handling of zero length matches has changed with python 3.7. Consider the following with python 3.6 (and previous): >>> import re >>> print(re.sub('a*', 'x', 'bac')) xbxcx >>> print(re.sub('.*', 'x', 'bac')) x We get the following with python 3.7: >>> import re >>> print(re.sub('a*', 'x', 'bac')) xbxxcx >>> print(re.sub('.*', 'x', 'bac')) xx I understand this is the standard behavior of PCRE. Furthermore, re.finditer() seems to have always detected the additional match: >>> for m in re