in reply to Re^4: phrase marking
in thread phrase marking
Include word boundaries in the patterns.
my @phrases = ( 'pail of water', 'pale horse' ); my $phrases_re = join '|', map { "\\b$_\\b" } map { quotemeta } @phrases; foreach my $sentence ( @sentence_source ) { $sentence =~ s/($phrases_re)/\#$1\#/g; }
(Note the extra map.)
|
|---|