DB<21> $test = qq|Some test. This is a test-with a dash. We want to match test here| DB<22> x $test =~ /\b(test)(?!-)\b/g 0 'test' 1 'test' DB<23> print pos($test),":$1\n" while $test =~ /\b(test)(?!-)\b/g 9:test 60:test