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