diff options
author | Noirin Shirley <colmsbook@nerdchic.net> | 2010-07-30 14:37:36 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2011-01-25 12:41:56 +0000 |
commit | c2ac899509f8338fa6da5832df112a00e5994c51 (patch) | |
tree | 0d811d3bdd717dea8e358f5cc28e6034430622c0 /pod/perlrequick.pod | |
parent | 645351953d2771a25790d35ac3b48384c9d4ff22 (diff) | |
download | perl-c2ac899509f8338fa6da5832df112a00e5994c51.tar.gz |
Small change to perlretut and perlrequick to fix Bug 76604
Diffstat (limited to 'pod/perlrequick.pod')
-rw-r--r-- | pod/perlrequick.pod | 6 |
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 |