www.perl.com
Perl Programming
Regular Expressions
  • Group subpatterns
    • () group a subpattern
  • Match repetitions
    • \1, \2 refer to the first and second groups

        my $string = "Did the fox jump over the dogs?";
        print "1: $string\n" if $string =~ m/(fox){2}/;     # "foxfox"
        print "2: $string\n" if $string =~ m/(the\s).*\1/;  # matches
      
Previous http://stuff.mit.edu/iap/perl/