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/perlretut.pod | |
parent | 645351953d2771a25790d35ac3b48384c9d4ff22 (diff) | |
download | perl-c2ac899509f8338fa6da5832df112a00e5994c51.tar.gz |
Small change to perlretut and perlrequick to fix Bug 76604
Diffstat (limited to 'pod/perlretut.pod')
-rw-r--r-- | pod/perlretut.pod | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pod/perlretut.pod b/pod/perlretut.pod index 3b7413efa9..e401bac3f8 100644 --- a/pod/perlretut.pod +++ b/pod/perlretut.pod @@ -979,11 +979,12 @@ Here are some examples: # any number of digits /(\w+)\s+\g1/; # match doubled words of arbitrary length /y(es)?/i; # matches 'y', 'Y', or a case-insensitive 'yes' - $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}(\d{2})?/; # same thing written differently. However, - # this produces $1 and the other does not. + $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}(\d{2})?$/; # same thing written differently. However, + # this captures the last two digits in $1 + # and the other does not. % simple_grep '^(\w+)\g1$' /usr/dict/words # isn't this easier? beriberi |