in reply to Match typo

Terrible spec: title and body content conflict. - -, and then change, repeatedly, in later nodes.

Working from the title, however,

#!/usr/bin/perl use strict; use warnings; # 794700 while(<DATA>){ # if($_ =~ m/\bpublication date\b/){ if($_ =~ m/\bpublication date\s/){ print $_; } } __DATA__ These are the dates. The publication date is 20-10-09 The publicatiion dateee is 20-05-08 The publication dat is 10-06-07 The publication date's are 20-10-09,29-02-08

Output with \b after "date" (incorrectly accepts "date's" which should be "dates" in this --plural-- context.)

perl 794700.pl The publication date is 20-10-09 The publication date's are 20-10-09,29-02-08

Output with \s after "date"

perl 794700.pl The publication date is 20-10-09

If one wishes to accept both "date" and "dates" (eg:

The publication date is 20-10-09 The publication dates are 20-10-09, 29-02-08)

alternation could be an answer:

if($_ =~ m/\bpublication date\s|\bpublication dates\s/){

Please see perldoc perlre (perlre) and company.