I want to include a space charcter in the map function below, so that each phrase pattern to be matched in the sentence also includes space characters on its either side. However, it does not work in the form below (although \b in place of \s works but it does not solve the actual problem). Any suggestions?
my $string = join '|', map { "\\s$_\\s" } map { quotemeta } @phrases; $sentence =~ s/($string)/\#$1\#/g;
Thanks.
#Corrected: $phrases replaced by $string
In reply to map function use by newbio
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |