diff options
author | Rim Chatti <chattiriim@gmail.com> | 2021-10-09 18:46:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-09 18:46:56 (GMT) |
commit | dbd62e74dadda7868f1c0d497414c8f7e4c0b12b (patch) | |
tree | 5a8c555c8b60e7b1c7bfa1300a204b048e5e5713 /Doc | |
parent | 543acbce5a1e23633379a853f38dc55b12f6d931 (diff) | |
download | cpython-dbd62e74dadda7868f1c0d497414c8f7e4c0b12b.zip cpython-dbd62e74dadda7868f1c0d497414c8f7e4c0b12b.tar.gz cpython-dbd62e74dadda7868f1c0d497414c8f7e4c0b12b.tar.bz2 |
Fix the "Finding all Adverbs" example (GH-21420)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/re.rst | 4 |
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 |