summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-10-10 21:43:58 (GMT)
committerGitHub <noreply@github.com>2021-10-10 21:43:58 (GMT)
commit5f44bb28fd9e98d681adff7e3329d6a863d3d5cd (patch)
treece122c29745c7b3d4d6f3f2994df4c6443ae008d /Doc
parente4fcb6fd3dcc4db23867c2fbd538189b8f221225 (diff)
downloadcpython-5f44bb28fd9e98d681adff7e3329d6a863d3d5cd.zip
cpython-5f44bb28fd9e98d681adff7e3329d6a863d3d5cd.tar.gz
cpython-5f44bb28fd9e98d681adff7e3329d6a863d3d5cd.tar.bz2
Fix the "Finding all Adverbs" example (GH-21420) (#28840)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> (cherry picked from commit dbd62e74dadda7868f1c0d497414c8f7e4c0b12b) Co-authored-by: Rim Chatti <chattiriim@gmail.com>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/re.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index ff7687c..b12ce4b 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -1572,7 +1572,7 @@ find all of the adverbs in some text, they might use :func:`findall` in
the following manner::
>>> text = "He was carefully disguised but captured quickly by police."
- >>> re.findall(r"\w+ly", text)
+ >>> re.findall(r"\w+ly\b", text)
['carefully', 'quickly']
@@ -1586,7 +1586,7 @@ a writer wanted to find all of the adverbs *and their positions* in
some text, they would use :func:`finditer` in the following manner::
>>> text = "He was carefully disguised but captured quickly by police."
- >>> for m in re.finditer(r"\w+ly", text):
+ >>> for m in re.finditer(r"\w+ly\b", text):
... print('%02d-%02d: %s' % (m.start(), m.end(), m.group(0)))
07-16: carefully
40-47: quickly