A regular expression is all what you need, take a look at perlre. Just to give you an example see if the following code does what you want:
my $text = 'whatever you want in here'; my $n = 10; my $word = 'match'; if ( $text=~ /(([.\s]+\w+){$n}[.\s]+$word[.\s]+(\w+[.\s]+){$n})/ ) { print $1; }
In reply to Re: extracting search term context
by bluescreen
in thread extracting search term context
by punkish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |