Help for this page

Select Code to Download


  1. or download this
    perl -e 'my $re = qr!yes|no!; print "$re\n";'
    prints: (?-xism:yes|no)
    
  2. or download this
    my $re = qr!yes|no!;
    print "yes or no!\n" if "yes" =~ $re;
    print "yes or no only" if "maybe" !~ $re;
    print "polite yes or no\n" if "yes thankyou" =~ /$re thankyou/;
    
  3. or download this
    my $re = qr!yes|no!;
    my $re2 = qr!\sthankyou!;
    print "yes or no!\n" if "yes" =~ $re;
    print "yes or no only" if "maybe" !~ $re;
    print "polite yes or no\n" if "yes thankyou" =~ /$re$re2/;