]> granicus.if.org Git - python/commitdiff
#13613: fix example in re doc.
authorEzio Melotti <ezio.melotti@gmail.com>
Fri, 16 Dec 2011 23:17:17 +0000 (01:17 +0200)
committerEzio Melotti <ezio.melotti@gmail.com>
Fri, 16 Dec 2011 23:17:17 +0000 (01:17 +0200)
Doc/library/re.rst

index 10a61c3ea8d7aa604b37c8a14f10f85b8cc123b2..307bc7e188b01f56c4d1a5b5a4e23f42875b6c45 100644 (file)
@@ -1000,16 +1000,16 @@ objects a little more gracefully:
 
 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=()>"