Ryan Westlund added the comment:
Sorry, I forgot the pydoc docs don't have as much information as the online
docs.
On Mon, Jun 22, 2020 at 1:54 PM Ezio Melotti wrote:
>
> Ezio Melotti added the comment:
>
> This behavior was changed in 3.7: "Empty matches for the pattern are
> replaced only
Ezio Melotti added the comment:
This behavior was changed in 3.7: "Empty matches for the pattern are replaced
only when not adjacent to a previous empty match, so sub('x*', '-', 'abxd')
returns '-a-b--d-'." [0]
See also bpo-32308 and bpo-25054.
[0]: https://docs.python.org/3/library/re.htm
New submission from Ryan Westlund :
```
>>> re.sub('a*', '-', 'a')
'--'
>>> re.sub('a*', '-', 'aa')
'--'
>>> re.sub('a*', '-', 'aaa')
'--'
```
Shouldn't it be returning one dash, not two, since the greedy quantifier will
match all the a's? I understand why substituting on 'b' returns '-a-', bu