Help for this page

Select Code to Download


  1. or download this
    my $point = 15;
    if ($str =~ /^(.{15})/ && $1 =~ /(regex)$/) {
        print "stuff before pos 15: $1\n";
    }
    
  2. or download this
    my $point = 15;
    my $start = 10;
    if (substr($str, $start, $point - $start) =~ /(regex)$/) {
        print "stuff before pos: $1\n";
    }
    
  3. or download this
    pos $str = 15;
    print "matched\n" if $str =~ /\G(?<=regex)/g;