10000 bpo-32308: Replace empty matches adjacent to a previous non-empty match in re.sub(). by serhiy-storchaka · Pull Request #4846 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-32308: Replace empty matches adjacent to a previous non-empty match in re.sub(). #4846

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 4, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix docs markup.
  • Loading branch information
serhiy-storchaka committed Dec 14, 2017
commit da9fdc250404eda5b0e5d07cce9517a7e830236a
6 changes: 3 additions & 3 deletions Doc/whatsnew/3.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -856,9 +856,9 @@ Changes in the Python API

:func:`re.sub()` now replaces empty matches adjacent to a previous
non-empty match. For example ``re.sub('x*', '-', 'abxd')`` returns now
``'-a-b--d-'`` instead of ``'-a-b--d-'`` (the first minus between `b` and
`d` replaces the `x`, and the second minus replaces 0 `x`' between
`x` and `d`).
``'-a-b--d-'`` instead of ``'-a-b--d-'`` (the first minus between 'b' and
'd' replaces 'x', and the second minus replaces an empty string between
'x' and 'd').

(Contributed by Serhiy Storchaka in :issue:`25054` and :issue:`32308`.)

Expand Down
0