From 7a1ce2affafe4ce54c1a803d146998d70b471b83 Mon Sep 17 00:00:00 2001 From: Adam Silkey Date: Tue, 19 Dec 2023 22:21:02 -0600 Subject: [PATCH 01/11] Update re docs to reflect Pattern methods signature The current docs for Pattern.search/match/matchall/finditer/findall imply that `pos`/`endpos` are positional arguments only. But, in fact, they support keyword assignment, as seen: >>> import re >>> pattern = re.compile('abc') >>> pattern.search('012abc678', pos=3) >>> pattern.search('012abc678', endpos=6) >>> pattern.search('012abc678', pos=3, endpos=6) The interactive help also shows this: >>> help(pattern.search) Help on built-in function search: search(string, pos=0, endpos=9223372036854775807) method of re.Pattern instance Scan through string looking for a match, and return a corresponding match object instance. Return None if no position in the string matches. (END) This commit updates the signatures of the affected methods in the doc to reflect. --- Doc/library/re.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 302f7224de4a7a..e12ec72f080ec9 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -1141,7 +1141,7 @@ Regular Expression Objects :py:class:`re.Pattern` supports ``[]`` to indicate a Unicode (str) or bytes pattern. See :ref:`types-genericalias`. -.. method:: Pattern.search(string[, pos[, endpos]]) +.. method:: Pattern.search(string, pos=0, endpos=sys.maxsize) Scan through *string* looking for the first location where this regular expression produces a match, and return a corresponding :class:`~re.Match`. @@ -1167,7 +1167,7 @@ Regular Expression Objects >>> pattern.search("dog", 1) # No match; search doesn't include the "d" -.. method:: Pattern.match(string[, pos[, endpos]]) +.. method:: Pattern.match(string, pos=0, endpos=sys.maxsize) If zero or more characters at the *beginning* of *string* match this regular expression, return a corresponding :class:`~re.Match`. Return ``None`` if the @@ -1186,7 +1186,7 @@ Regular Expression Objects :meth:`~Pattern.search` instead (see also :ref:`search-vs-match`). -.. method:: Pattern.fullmatch(string[, pos[, endpos]]) +.. method:: Pattern.fullmatch(string, pos=0, endpos=sys.maxsize) If the whole *string* matches this regular expression, return a corresponding :class:`~re.Match`. Return ``None`` if the string does not match the pattern; @@ -1209,14 +1209,14 @@ Regular Expression Objects Identical to the :func:`split` function, using the compiled pattern. -.. method:: Pattern.findall(string[, pos[, endpos]]) +.. method:: Pattern.findall(string, pos=0, endpos=sys.maxsize) Similar to the :func:`findall` function, using the compiled pattern, but also accepts optional *pos* and *endpos* parameters that limit the search region like for :meth:`search`. -.. method:: Pattern.finditer(string[, pos[, endpos]]) +.. method:: Pattern.finditer(string, pos=0, endpos=sys.maxsize) Similar to the :func:`finditer` function, using the compiled pattern, but also accepts optional *pos* and *endpos* parameters that limit the search From 6f9a22a7f2dd8845cec7a61529f92edc3060a802 Mon Sep 17 00:00:00 2001 From: Adam Silkey Date: Tue, 19 Dec 2023 22:29:35 -0600 Subject: [PATCH 02/11] Add Special Characters section to re docs Add special characters section to docs to enable finding via the table of contents and make discoverability easier. --- Doc/library/re.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Doc/library/re.rst b/Doc/library/re.rst index e12ec72f080ec9..1667f3de40139a 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -94,6 +94,9 @@ repetition to an inner repetition, parentheses may be used. For example, the expression ``(?:a{6})*`` matches any multiple of six ``'a'`` characters. +Special Characters +^^^^^^^^^^^^^^^^^^ + The special characters are: .. index:: single: . (dot); in regular expressions From 05f77b76036b29f963b08448e3b102eb99e1580c Mon Sep 17 00:00:00 2001 From: Adam Silkey Date: Tue, 19 Dec 2023 19:04:54 -0600 Subject: [PATCH 03/11] Add pos/endpos parameters to re module functions This commit adds the `pos` and `endpos` parameters to the following top-level `re` module functions: - `re.match()` - `re.fullmatch()` - `re.search()` - `re.findall()` - `re.finditer()` Prior to this commit, the `pos` and `endpos` parameters were only available to users by first compiling a pattern using `re.compile`. Adding these optional arguments standardizes the behavior between the two and prevents users from being forced to compile if they wish to use the `pos`/`endpos` arguments. Rationale: There are a number of methods in the Python Regex Pattern class that support optional positional arguments (pos/endpos): - `Pattern.match(string[, pos[, endpos]])` - `Pattern.fullmatch(string[, pos[, endpos]])` - `Pattern.search(string[, pos[, endpos]])` - `Pattern.findall(string[, pos[, endpos]])` - `Pattern.finditer(string[, pos[, endpos]])` Additionally, Python provides access to these pattern methods as top-level convenience functions in the module itself: - `re.search()` - `re.match()` - `re.fullmatch()` - `re.findall()` - `re.finditer()` However, these top-level convenience functions do not support the optional arguments. If anyone wants to utilize the optional arguments, they must first compile a pattern with `re.compile()` and then call the method with the optional arguments. But all the top-level convenience functions do is compile the pattern, and then execute the pattern, as seen in the commit diff. Looking at the underlying C Code for these methods, the method defines `pos` and `endpos` as `0` and `PY_SSIZE_T_MAX` respectively. It only changes the values if the arg parser detects the presence of either `pos` or `endpos`. Here is an example from the match function: ```c static PyObject * _sre_SRE_Pattern_match(PatternObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { (...) Py_ssize_t pos = 0; Py_ssize_t endpos = PY_SSIZE_T_MAX; (...) pos = ival; (...) endpos = ival; (...) return_value = _sre_SRE_Pattern_match_impl(self, cls, string, pos, endpos); ``` --- Lib/re/__init__.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Lib/re/__init__.py b/Lib/re/__init__.py index 7e8abbf6ffe155..54fe32d32991cc 100644 --- a/Lib/re/__init__.py +++ b/Lib/re/__init__.py @@ -123,6 +123,7 @@ """ import enum +import sys from . import _compiler, _parser import functools import _sre @@ -161,20 +162,20 @@ class RegexFlag: # -------------------------------------------------------------------- # public interface -def match(pattern, string, flags=0): +def match(pattern, string, flags=0, pos=0, endpos=sys.maxsize): """Try to apply the pattern at the start of the string, returning a Match object, or None if no match was found.""" - return _compile(pattern, flags).match(string) + return _compile(pattern, flags).match(string, pos=pos, endpos=endpos) -def fullmatch(pattern, string, flags=0): +def fullmatch(pattern, string, flags=0, pos=0, endpos=sys.maxsize): """Try to apply the pattern to all of the string, returning a Match object, or None if no match was found.""" - return _compile(pattern, flags).fullmatch(string) + return _compile(pattern, flags).fullmatch(string, pos=pos, endpos=endpos) -def search(pattern, string, flags=0): +def search(pattern, string, flags=0, pos=0, endpos=sys.maxsize): """Scan through string looking for a match to the pattern, returning a Match object, or None if no match was found.""" - return _compile(pattern, flags).search(string) + return _compile(pattern, flags).search(string, pos=pos, endpos=endpos) class _ZeroSentinel(int): pass @@ -267,7 +268,7 @@ def split(pattern, string, *args, maxsplit=_zero_sentinel, flags=_zero_sentinel) return _compile(pattern, flags).split(string, maxsplit) split.__text_signature__ = '(pattern, string, maxsplit=0, flags=0)' -def findall(pattern, string, flags=0): +def findall(pattern, string, flags=0, pos=0, endpos=sys.maxsize): """Return a list of all non-overlapping matches in the string. If one or more capturing groups are present in the pattern, return @@ -275,14 +276,14 @@ def findall(pattern, string, flags=0): has more than one group. Empty matches are included in the result.""" - return _compile(pattern, flags).findall(string) + return _compile(pattern, flags).findall(string, pos=pos, endpos=endpos) -def finditer(pattern, string, flags=0): +def finditer(pattern, string, flags=0, pos=0, endpos=sys.maxsize): """Return an iterator over all non-overlapping matches in the string. For each match, the iterator returns a Match object. Empty matches are included in the result.""" - return _compile(pattern, flags).finditer(string) + return _compile(pattern, flags).finditer(string, pos=pos, endpos=endpos) def compile(pattern, flags=0): "Compile a regular expression pattern, returning a Pattern object." From d7395748ab946230022b242b75006c01ae28193f Mon Sep 17 00:00:00 2001 From: Adam Silkey Date: Tue, 19 Dec 2023 20:29:14 -0600 Subject: [PATCH 04/11] Update module docstrings --- Lib/re/__init__.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Lib/re/__init__.py b/Lib/re/__init__.py index 54fe32d32991cc..30b6173cde0e0c 100644 --- a/Lib/re/__init__.py +++ b/Lib/re/__init__.py @@ -117,6 +117,25 @@ U UNICODE For compatibility only. Ignored for string patterns (it is the default), and forbidden for bytes patterns. +The following functions support optional pos/endpos arguments: + match + fullmatch + search + findall + finditer + +The optional parameter pos gives an index in the string where the search is +to start; it defaults to 0. This is not completely equivalent to slicing the +string; the '^' pattern character matches at the real beginning of the string +and at positions just after a newline, but not necessarily at the index where +the search is to start. + +The optional parameter endpos limits how far the string will be searched; +it will be as if the string is endpos characters long, so only the characters +from pos to endpos - 1 will be searched for a match. If endpos is less than +pos, no match will be found. Otherwise, if rx is a compiled regular expression +object, rx.search(string, 0, 50) is equivalent to rx.search(string[:50], 0). + This module also defines exception 'PatternError', aliased to 'error' for backward compatibility. From a690fa11b086c652eb35da5906a61c75559136da Mon Sep 17 00:00:00 2001 From: Adam Silkey Date: Tue, 19 Dec 2023 21:38:32 -0600 Subject: [PATCH 05/11] Add tests for pos/endpos --- Lib/test/test_re.py | 55 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 993a7d6e264a1f..c986c45c2e98f2 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -1981,6 +1981,61 @@ def test_keyword_parameters(self): pat.scanner(string='abracadabra', pos=3, endpos=10).search().span(), (7, 9)) + def test_module_function_pos_endpos(self): + # pos/endpos - positional arguments + self.assertEqual( + re.match(r'(ab)', 'abracadabra', 0, 7).span(), (7, 9)) + self.assertEqual( + re.match(r'(ab)', 'abracadabra', 0, 7, 10).span(), (7, 9)) + self.assertEqual( + re.fullmatch(r'(abra)', 'abracadabra', 1, 7).span(), (7, 11)) + self.assertEqual( + re.fullmatch(r'(ab)', 'abracadabra', 0, 7, 9).span(), (7, 9)) + self.assertEqual( + re.search(r'(ab)', 'abracadabra', 0, 3).span(), (7, 9)) + self.assertEqual( + re.search(r'(ab)', 'abracadabra', 0, 3, 10).span(), (7, 9)) + self.assertEqual( + re.findall(r'(ab)', 'abracadabracadabra', 0, 3), ['ab', 'ab']) + self.assertEqual( + re.findall(r'(ab)', 'abracadabracadabra', 0, 3, 16), ['ab', 'ab']) + iter = re.finditer(r":+", "a:b::c:::d", 0, 3) + self.assertEqual([item.group(0) for item in iter], ["::", ":::"]) + iter = re.finditer(r":+", "a:b::c:::d", 0, 3, 10) + self.assertEqual([item.group(0) for item in iter], ["::", ":::"]) + + # pos/endpos - keyword arguments + self.assertEqual( + re.match(r'(ab)', 'abracadabra', pos=7).span(), (7, 9)) + self.assertEqual( + re.match(r'(ab)', 'abracadabra', endpos=9).span(), (0, 2)) + self.assertEqual( + re.match(r'(ab)', 'abracadabra', pos=7, endpos=9).span(), (7, 9)) + self.assertEqual( + re.fullmatch(r'(abra)', 'abracadabra', pos=7).span(), (7, 11)) + self.assertEqual( + re.fullmatch(r'(ab)', 'abracadabra', endpos=2).span(), (0, 2)) + self.assertEqual( + re.fullmatch(r'(ab)', 'abracadabra', pos=7, endpos=9).span(), (7, 9)) + self.assertEqual( + re.search(r'(ab)', 'abracadabra', pos=3).span(), (7, 9)) + self.assertEqual( + re.search(r'(ab)', 'abracadabra', endpos=9).span(), (0, 2)) + self.assertEqual( + re.search(r'(ab)', 'abracadabra', pos=3, endpos=9).span(), (7, 9)) + self.assertEqual( + re.findall(r':+', 'a:b::c:::d', pos=3), ['::', ':::']) + self.assertEqual( + re.findall(r':+', 'a:b::c:::d', endpos=6), [':', '::']) + self.assertEqual( + re.findall(r':+', 'a:b::c:::d', pos=3, endpos=10), ['::', ':::']) + iter = re.finditer(r':+', 'a:b::c:::d', pos=3) + self.assertEqual([item.group(0) for item in iter], ['::', ':::']) + iter = re.finditer(r':+', 'a:b::c:::d', endpos=6) + self.assertEqual([item.group(0) for item in iter], [':', '::']) + iter = re.finditer(r':+', 'a:b::c:::d', pos=3, endpos=10) + self.assertEqual([item.group(0) for item in iter], ['::', ':::']) + def test_bug_20998(self): # Issue #20998: Fullmatch of repeated single character pattern # with ignore case. From 6bf8f12656e8a31a99a74237df9f2bfe7f39fc34 Mon Sep 17 00:00:00 2001 From: Adam Silkey Date: Tue, 19 Dec 2023 22:17:50 -0600 Subject: [PATCH 06/11] Update re docs to include string indexing - Add new header section describing the string indexing arguments - Update function signatures to reflect changes --- Doc/library/re.rst | 59 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 1667f3de40139a..0f4799c367496b 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -821,6 +821,40 @@ Flags Corresponds to the inline flag ``(?x)``. +String Indexing Arguments +^^^^^^^^^^^^^^^^^^^^^^^^^ + +The following functions and related ``Pattern`` methods support optional string +index ``pos`` & ``endpos`` arguments: + + * ``re.match()`` & ``Pattern.match()`` + * ``re.fullmatch()`` & ``Pattern.fullmatch()`` + * ``re.search()`` & ``Pattern.search()`` + * ``re.findall()`` & ``Pattern.findall()`` + * ``re.finditer()`` & ``Pattern.finditer()`` + +The optional parameter *pos* gives an index in the string where the search is +to start; it defaults to ``0``. This is not completely equivalent to slicing +the string; the ``'^'`` pattern character matches at the real beginning of the +string and at positions just after a newline, but not necessarily at the index +where the search is to start. + +The optional parameter *endpos* limits how far the string will be searched; it +will be as if the string is *endpos* characters long, so only the characters +from *pos* to ``endpos - 1`` will be searched for a match. If *endpos* is less +than *pos*, no match will be found; otherwise, if *rx* is a compiled regular +expression object, ``rx.search(string, 0, 50)`` is equivalent to +``rx.search(string[:50], 0)``.:: + + >>> pattern = re.compile("d") + >>> pattern.search("dog") # Match at index 0 + + >>> pattern.search("dog", 1) # No match; search doesn't include the "d" + +.. versionchanged:: 3.13 + Top-level module functions now support ``pos`` and ``endpos``. + + Functions ^^^^^^^^^ @@ -856,15 +890,18 @@ Functions about compiling regular expressions. -.. function:: search(pattern, string, flags=0) +.. function:: search(pattern, string, flags=0, pos=0, endpos=sys.maxsize) Scan through *string* looking for the first location where the regular expression *pattern* produces a match, and return a corresponding :class:`~re.Match`. Return ``None`` if no position in the string matches the pattern; note that this is different from finding a zero-length match at some point in the string. + .. versionchanged:: 3.13 + Now supports ``pos`` and ``endpos``. + -.. function:: match(pattern, string, flags=0) +.. function:: match(pattern, string, flags=0, pos=0, endpos=sys.maxsize) If zero or more characters at the beginning of *string* match the regular expression *pattern*, return a corresponding :class:`~re.Match`. Return @@ -877,8 +914,11 @@ Functions If you want to locate a match anywhere in *string*, use :func:`search` instead (see also :ref:`search-vs-match`). + .. versionchanged:: 3.13 + Now supports ``pos`` and ``endpos``. + -.. function:: fullmatch(pattern, string, flags=0) +.. function:: fullmatch(pattern, string, flags=0, pos=0, endpos=sys.maxsize) If the whole *string* matches the regular expression *pattern*, return a corresponding :class:`~re.Match`. Return ``None`` if the string does not match @@ -886,6 +926,9 @@ Functions .. versionadded:: 3.4 + .. versionchanged:: 3.13 + Now supports ``pos`` and ``endpos``. + .. function:: split(pattern, string, maxsplit=0, flags=0) @@ -936,7 +979,7 @@ Functions :ref:`keyword-only parameters `. -.. function:: findall(pattern, string, flags=0) +.. function:: findall(pattern, string, flags=0, pos=0, endpos=sys.maxsize) Return all non-overlapping matches of *pattern* in *string*, as a list of strings or tuples. The *string* is scanned left-to-right, and matches @@ -957,8 +1000,11 @@ Functions .. versionchanged:: 3.7 Non-empty matches can now start just after a previous empty match. + .. versionchanged:: 3.13 + Now supports ``pos`` and ``endpos``. + -.. function:: finditer(pattern, string, flags=0) +.. function:: finditer(pattern, string, flags=0, pos=0, endpos=sys.maxsize) Return an :term:`iterator` yielding :class:`~re.Match` objects over all non-overlapping matches for the RE *pattern* in *string*. The *string* @@ -968,6 +1014,9 @@ Functions .. versionchanged:: 3.7 Non-empty matches can now start just after a previous empty match. + .. versionchanged:: 3.13 + Now supports ``pos`` and ``endpos``. + .. function:: sub(pattern, repl, string, count=0, flags=0) From 69ed40258dfe04bd447fc47fde9a6a1e86a16fec Mon Sep 17 00:00:00 2001 From: Adam Silkey Date: Tue, 19 Dec 2023 22:43:03 -0600 Subject: [PATCH 07/11] Add Adam Silkey to ACKS --- Misc/ACKS | 1 + 1 file changed, 1 insertion(+) diff --git a/Misc/ACKS b/Misc/ACKS index 6b98be32905391..a4e21e055da007 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1695,6 +1695,7 @@ Reilly Tucker Siemens Paul Sijben SilentGhost Tim Silk +Adam Silkey Michael Simcich Ionel Simionescu Kirill Simonov From 43a7248d2a6351d74f8733f6e809a50b19b175d2 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 20 Dec 2023 06:59:46 +0000 Subject: [PATCH 08/11] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20b?= =?UTF-8?q?lurb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Library/2023-12-20-06-59-45.gh-issue-113304.8PdOM_.rst | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2023-12-20-06-59-45.gh-issue-113304.8PdOM_.rst diff --git a/Misc/NEWS.d/next/Library/2023-12-20-06-59-45.gh-issue-113304.8PdOM_.rst b/Misc/NEWS.d/next/Library/2023-12-20-06-59-45.gh-issue-113304.8PdOM_.rst new file mode 100644 index 00000000000000..45419f7b45cc45 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-12-20-06-59-45.gh-issue-113304.8PdOM_.rst @@ -0,0 +1,7 @@ +Add `pos`/`endpos` parameters to top-level re module functions: + +- `re.search()` +- `re.match()` +- `re.fullmatch()` +- `re.findall()` +- `re.finditer()` From 22aa7b2cd020e5b3dd4ecebd9d3c15df57b3dbb5 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 20 Dec 2023 07:06:40 +0000 Subject: [PATCH 09/11] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20b?= =?UTF-8?q?lurb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Library/2023-12-20-07-06-39.gh-issue-113304.8PdOM_.rst | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2023-12-20-07-06-39.gh-issue-113304.8PdOM_.rst diff --git a/Misc/NEWS.d/next/Library/2023-12-20-07-06-39.gh-issue-113304.8PdOM_.rst b/Misc/NEWS.d/next/Library/2023-12-20-07-06-39.gh-issue-113304.8PdOM_.rst new file mode 100644 index 00000000000000..45419f7b45cc45 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-12-20-07-06-39.gh-issue-113304.8PdOM_.rst @@ -0,0 +1,7 @@ +Add `pos`/`endpos` parameters to top-level re module functions: + +- `re.search()` +- `re.match()` +- `re.fullmatch()` +- `re.findall()` +- `re.finditer()` From 54e50cb9db45d974b07e6900986ea7c08667c38b Mon Sep 17 00:00:00 2001 From: Adam Silkey Date: Wed, 20 Dec 2023 01:19:01 -0600 Subject: [PATCH 10/11] Add blurb and remove previous blurbs --- .../Library/2023-12-20-01-17-58.gh-issue-113304.fE5U8G.rst | 1 + .../Library/2023-12-20-06-59-45.gh-issue-113304.8PdOM_.rst | 7 ------- .../Library/2023-12-20-07-06-39.gh-issue-113304.8PdOM_.rst | 7 ------- 3 files changed, 1 insertion(+), 14 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2023-12-20-01-17-58.gh-issue-113304.fE5U8G.rst delete mode 100644 Misc/NEWS.d/next/Library/2023-12-20-06-59-45.gh-issue-113304.8PdOM_.rst delete mode 100644 Misc/NEWS.d/next/Library/2023-12-20-07-06-39.gh-issue-113304.8PdOM_.rst diff --git a/Misc/NEWS.d/next/Library/2023-12-20-01-17-58.gh-issue-113304.fE5U8G.rst b/Misc/NEWS.d/next/Library/2023-12-20-01-17-58.gh-issue-113304.fE5U8G.rst new file mode 100644 index 00000000000000..840f9cb8cb0243 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-12-20-01-17-58.gh-issue-113304.fE5U8G.rst @@ -0,0 +1 @@ +Add ``pos``/``endpos`` parameters to top-level re module functions. diff --git a/Misc/NEWS.d/next/Library/2023-12-20-06-59-45.gh-issue-113304.8PdOM_.rst b/Misc/NEWS.d/next/Library/2023-12-20-06-59-45.gh-issue-113304.8PdOM_.rst deleted file mode 100644 index 45419f7b45cc45..00000000000000 --- a/Misc/NEWS.d/next/Library/2023-12-20-06-59-45.gh-issue-113304.8PdOM_.rst +++ /dev/null @@ -1,7 +0,0 @@ -Add `pos`/`endpos` parameters to top-level re module functions: - -- `re.search()` -- `re.match()` -- `re.fullmatch()` -- `re.findall()` -- `re.finditer()` diff --git a/Misc/NEWS.d/next/Library/2023-12-20-07-06-39.gh-issue-113304.8PdOM_.rst b/Misc/NEWS.d/next/Library/2023-12-20-07-06-39.gh-issue-113304.8PdOM_.rst deleted file mode 100644 index 45419f7b45cc45..00000000000000 --- a/Misc/NEWS.d/next/Library/2023-12-20-07-06-39.gh-issue-113304.8PdOM_.rst +++ /dev/null @@ -1,7 +0,0 @@ -Add `pos`/`endpos` parameters to top-level re module functions: - -- `re.search()` -- `re.match()` -- `re.fullmatch()` -- `re.findall()` -- `re.finditer()` From 59d1a931a083ca28451b1c3078a76b363ef3e860 Mon Sep 17 00:00:00 2001 From: Adam Silkey Date: Wed, 20 Dec 2023 01:58:19 -0600 Subject: [PATCH 11/11] Fix docs: arguments -> parameters --- Doc/library/re.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 0f4799c367496b..599cd0f738af76 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -825,7 +825,7 @@ String Indexing Arguments ^^^^^^^^^^^^^^^^^^^^^^^^^ The following functions and related ``Pattern`` methods support optional string -index ``pos`` & ``endpos`` arguments: +index ``pos`` & ``endpos`` parameters: * ``re.match()`` & ``Pattern.match()`` * ``re.fullmatch()`` & ``Pattern.fullmatch()``