Help for this page

Select Code to Download


  1. or download this
    # Check for a match
    if (/pat/) {
    ...
    while (/pat/g) {
       ...
    }
    
  2. or download this
    print( 'abc' =~ /b/      ?1:0,"\n");  # 1
    print( 'abc' =~ /^b\z/   ?1:0,"\n");  # 0
    ...
    print( 'a2b3c' =~ /(\d)/     ?$1:0,"\n");  # 2
    print( 'a2b3c' =~ /^.*(\d)/  ?$1:0,"\n");  # 3
    print( 'a2b3c' =~ /^.*?(\d)/ ?$1:0,"\n");  # 2