[Python-checkins] r60164 - python/trunk/Lib/re.py
georg.brandl
python-checkins at python.org
Mon Jan 21 18:29:23 CET 2008
Author: georg.brandl
Date: Mon Jan 21 18:29:23 2008
New Revision: 60164
Modified:
python/trunk/Lib/re.py
Log:
Clarify $ behavior in re docstring. #1631394.
Modified: python/trunk/Lib/re.py
==============================================================================
--- python/trunk/Lib/re.py (original)
+++ python/trunk/Lib/re.py Mon Jan 21 18:29:23 2008
@@ -29,7 +29,8 @@
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 @@
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.
More information about the Python-checkins
mailing list