$word = qr[[a-zA-Z']+];; $sep = qr[[ \t.,!?]+];; $n=10; $match = 'match'; $re = qr[((?:$word$sep){$n}\Q$match\E(?:$sep$word){$n})];; print $para =~ $re;; want to extract n words on either side of the match. I am sure modules such as Plucene or KinoSearch already #### $re = qr[((?:$word$sep){0,$n}\Q$match\E(?:$sep$word){0,$n})];; $match = 'CPAN';; print $para =~ m[$re];; There probably is already a CPAN module for this, but I am stuck trying to figure