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