in reply to removing stop words
It works fine for me:
use strict; use warnings; my $s = 'a foo about foo above foo across foo after foo afterwards'; $s =~ s/\ba\b|\babout\b|\babove\b|\bacross\b|\bafter\b|\bafterwards\b/ +/g; print "$s\n"; __END__ foo foo foo foo foo
BTW, you can tighten that regexp without loss of generality:
$s =~ s/\b(?:a|about|above|across|after|afterwards)\b//g;
Update: Thanks to graff for reminding me that the capture was not necessary. Added the ?: bit.
the lowliest monk
|
|---|