[Python-checkins] cpython (merge 3.2 -> default): #13613: merge with 3.2.
ezio.melotti
python-checkins at python.org
Sat Dec 17 00:20:23 CET 2011
http://hg.python.org/cpython/rev/f2e1867f33b8
changeset: 74005:f2e1867f33b8
parent: 74002:279b0aee0cfb
parent: 74004:0b86da9d6964
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Sat Dec 17 01:20:02 2011 +0200
summary:
#13613: merge with 3.2.
files:
Doc/library/re.rst | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -1021,16 +1021,16 @@
Suppose you are writing a poker program where a player's hand is represented as
a 5-character string with each character representing a card, "a" for ace, "k"
-for king, "q" for queen, j for jack, "0" for 10, and "1" through "9"
+for king, "q" for queen, "j" for jack, "t" for 10, and "2" through "9"
representing the card with that value.
To see if a given string is a valid hand, one could do the following:
- >>> valid = re.compile(r"[0-9akqj]{5}$")
- >>> displaymatch(valid.match("ak05q")) # Valid.
- "<Match: 'ak05q', groups=()>"
- >>> displaymatch(valid.match("ak05e")) # Invalid.
- >>> displaymatch(valid.match("ak0")) # Invalid.
+ >>> valid = re.compile(r"^[a2-9tjqk]{5}$")
+ >>> displaymatch(valid.match("akt5q")) # Valid.
+ "<Match: 'akt5q', groups=()>"
+ >>> displaymatch(valid.match("akt5e")) # Invalid.
+ >>> displaymatch(valid.match("akt")) # Invalid.
>>> displaymatch(valid.match("727ak")) # Valid.
"<Match: '727ak', groups=()>"
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list