www.perl.com
Perl Programming
Regular Expressions
  • Regexes may be quoted in several ways
    • Regex quotes are usually slashes (/regex/)
    • May use other quotes with the match operator m
    • Use other quotes when matching slashes (m[/])
    • Comparison operators (=~, !~) test for matches

        my $string = "Did the fox jump over the dogs?";
        print "1: $string\n" if $string =~ /dog/;          # matches
        print "2: $string\n" if $string =~ m/dog/;         # matches
        print "3: $string\n" if $string =~ m(dog);         # matches
        print "4: $string\n" if $string =~ m|dog|;         # matches
      
Previous http://stuff.mit.edu/iap/perl/