summaryrefslogtreecommitdiff
path: root/pod/perlrequick.pod
diff options
context:
space:
mode:
authorNoirin Shirley <colmsbook@nerdchic.net>2010-07-30 14:37:36 +0100
committerDavid Mitchell <davem@iabyn.com>2011-01-25 12:41:56 +0000
commitc2ac899509f8338fa6da5832df112a00e5994c51 (patch)
tree0d811d3bdd717dea8e358f5cc28e6034430622c0 /pod/perlrequick.pod
parent645351953d2771a25790d35ac3b48384c9d4ff22 (diff)
downloadperl-c2ac899509f8338fa6da5832df112a00e5994c51.tar.gz
Small change to perlretut and perlrequick to fix Bug 76604
Diffstat (limited to 'pod/perlrequick.pod')
-rw-r--r--pod/perlrequick.pod6
1 files changed, 3 insertions, 3 deletions
diff --git a/pod/perlrequick.pod b/pod/perlrequick.pod
index 1fde5588d6..7d8cd8e5e0 100644
--- a/pod/perlrequick.pod
+++ b/pod/perlrequick.pod
@@ -348,9 +348,9 @@ Here are some examples:
/[a-z]+\s+\d*/; # match a lowercase word, at least some space, and
# any number of digits
/(\w+)\s+\g1/; # match doubled words of arbitrary length
- $year =~ /\d{2,4}/; # make sure year is at least 2 but not more
- # than 4 digits
- $year =~ /\d{4}|\d{2}/; # better match; throw out 3 digit dates
+ $year =~ /^\d{2,4}$/; # make sure year is at least 2 but not more
+ # than 4 digits
+ $year =~ /^\d{4}$|^\d{2}$/; # better match; throw out 3 digit dates
These quantifiers will try to match as much of the string as possible,
while still allowing the regex to match. So we have