Help for this page

Select Code to Download


  1. or download this
    $s = 'aaaaaaaaa';
    $s =~ /.+(a+)/;    # greedy match
    ...
    $s = 'aaaaaaaaa';
    $s =~ /.+?(a+)/;   # non-greedy match
    print "$1\n";      # prints "aaaaaaaa" (all the 'a's)
    
  2. or download this
    $text =~ /$mm\/$dd\/$yy/;   # works, but ugly
    $text =~ m|$mm/$dd/$yy|;    # use different delimiter
    ...
                /
                $yy            # year
              |x;              # allow whitespace