Skip to content

Commit dbd62e7

Browse files
Fix the "Finding all Adverbs" example (GH-21420)
Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent 543acbc commit dbd62e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Doc/library/re.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ find all of the adverbs in some text, they might use :func:`findall` in
15721572
the following manner::
15731573

15741574
>>> text = "He was carefully disguised but captured quickly by police."
1575-
>>> re.findall(r"\w+ly", text)
1575+
>>> re.findall(r"\w+ly\b", text)
15761576
['carefully', 'quickly']
15771577

15781578

@@ -1586,7 +1586,7 @@ a writer wanted to find all of the adverbs *and their positions* in
15861586
some text, they would use :func:`finditer` in the following manner::
15871587

15881588
>>> text = "He was carefully disguised but captured quickly by police."
1589-
>>> for m in re.finditer(r"\w+ly", text):
1589+
>>> for m in re.finditer(r"\w+ly\b", text):
15901590
... print('%02d-%02d: %s' % (m.start(), m.end(), m.group(0)))
15911591
07-16: carefully
15921592
40-47: quickly

0 commit comments

Comments
 (0)