Skip to content

Commit dbe6fd9

Browse files
author
Ed Avis
committed
gh-125579: Change code examples to help when searching for 'capture' (#125579)
1 parent 37e533a commit dbe6fd9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Doc/library/re.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,7 +1808,7 @@ one as :func:`search` does. For example, if a writer wanted to
18081808
find all of the adverbs in some text, they might use :func:`findall` in
18091809
the following manner::
18101810

1811-
>>> text = "He was carefully disguised but captured quickly by police."
1811+
>>> text = "He was carefully disguised but found quickly by police."
18121812
>>> re.findall(r"\w+ly\b", text)
18131813
['carefully', 'quickly']
18141814

@@ -1822,11 +1822,11 @@ instead of strings. Continuing with the previous example, if a writer wanted
18221822
to find all of the adverbs *and their positions* in some text, they would use
18231823
:func:`finditer` in the following manner::
18241824

1825-
>>> text = "He was carefully disguised but captured quickly by police."
1825+
>>> text = "He was carefully disguised but found quickly by police."
18261826
>>> for m in re.finditer(r"\w+ly\b", text):
18271827
... print('%02d-%02d: %s' % (m.start(), m.end(), m.group(0)))
18281828
07-16: carefully
1829-
40-47: quickly
1829+
37-44: quickly
18301830

18311831

18321832
Raw String Notation

0 commit comments

Comments
 (0)