@@ -988,8 +988,8 @@ Functions
988
988
That way, separator components are always found at the same relative
989
989
indices within the result list.
990
990
991
- Empty matches for the pattern split the string only when not adjacent
992
- to a previous empty match.
991
+ Adjacent empty matches are not possible, but an empty match can occur
992
+ immediately after a non- empty match.
993
993
994
994
.. code :: pycon
995
995
@@ -1092,9 +1092,12 @@ Functions
1092
1092
1093
1093
The optional argument *count * is the maximum number of pattern occurrences to be
1094
1094
replaced; *count * must be a non-negative integer. If omitted or zero, all
1095
- occurrences will be replaced. Empty matches for the pattern are replaced only
1096
- when not adjacent to a previous empty match, so ``sub('x*', '-', 'abxd') `` returns
1097
- ``'-a-b--d-' ``.
1095
+ occurrences will be replaced.
1096
+
1097
+ Adjacent empty matches are not possible, but an empty match can occur
1098
+ immediately after a non-empty match.
1099
+ As a result, ``sub('x*', '-', 'abxd') `` returns ``'-a-b--d-' ``
1100
+ instead of ``'-a-b-d-' ``.
1098
1101
1099
1102
.. index :: single: \g; in regular expressions
1100
1103
@@ -1125,8 +1128,7 @@ Functions
1125
1128
.. versionchanged :: 3.7
1126
1129
Unknown escapes in *repl * consisting of ``'\' `` and an ASCII letter
1127
1130
now are errors.
1128
- Empty matches for the pattern are replaced when adjacent to a previous
1129
- non-empty match.
1131
+ An empty match can occur immediately after a non-empty match.
1130
1132
1131
1133
.. versionchanged :: 3.12
1132
1134
Group *id * can only contain ASCII digits.
0 commit comments