summaryrefslogtreecommitdiffstats
path: root/Lib/re.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-01-21 17:29:23 (GMT)
committerGeorg Brandl <georg@python.org>2008-01-21 17:29:23 (GMT)
commite42169124f25316195c9a31a88df5c0a82e2c2bb (patch)
treed4f8f226be3b5f70561dbfe1ad90b9acf68f2b3c /Lib/re.py
parent1ea8cb49ed728dadec11d0a554431c566fdc5a56 (diff)
downloadcpython-e42169124f25316195c9a31a88df5c0a82e2c2bb.zip
cpython-e42169124f25316195c9a31a88df5c0a82e2c2bb.tar.gz
cpython-e42169124f25316195c9a31a88df5c0a82e2c2bb.tar.bz2
Clarify $ behavior in re docstring. #1631394.
Diffstat (limited to 'Lib/re.py')
-rw-r--r--Lib/re.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/re.py b/Lib/re.py
index 39e81fd..968eaab 100644
--- a/Lib/re.py
+++ b/Lib/re.py
@@ -29,7 +29,8 @@ concatenate ordinary characters, so last matches the string 'last'.
The special characters are:
"." Matches any character except a newline.
"^" Matches the start of the string.
- "$" Matches the end of the string.
+ "$" Matches the end of the string or just before the newline at
+ the end of the string.
"*" Matches 0 or more (greedy) repetitions of the preceding RE.
Greedy means that it will match as many repetitions as possible.
"+" Matches 1 or more (greedy) repetitions of the preceding RE.
@@ -83,8 +84,10 @@ This module exports the following functions:
Some of the functions in this module takes flags as optional parameters:
I IGNORECASE Perform case-insensitive matching.
L LOCALE Make \w, \W, \b, \B, dependent on the current locale.
- M MULTILINE "^" matches the beginning of lines as well as the string.
- "$" matches the end of lines as well as the string.
+ M MULTILINE "^" matches the beginning of lines (after a newline)
+ as well as the string.
+ "$" matches the end of lines (before a newline) as well
+ as the end of the string.
S DOTALL "." matches any character at all, including the newline.
X VERBOSE Ignore whitespace and comments for nicer looking RE's.
U UNICODE Make \w, \W, \b, \B, dependent on the Unicode locale.