Help for this page

Select Code to Download


  1. or download this
     $s = 'I have somwhat large articles of text (returned from a search),
    + what I\'d like to do is capture the word and X number of words befor
    +e and after it while tagging the matching word in the captured text.'
    +;;
    
    print $s =~ m[ ( (?: \S+ \s+ ){3} X (?: \s+ \S+ ){3} ) ]x;;
    
    the word and X number of words
    
  2. or download this
    #! perl -slw
    use strict;
    ...
    Is there a way to do this with a single regex? Is a regex even the bes
    +t
    way to do this? Thanks, -Lee
    
  3. or download this
    P:\test>junk me
    weak spot for <me> and I've got
    ...
    there a way <to> do this with
    even the bestway <to> do this? Thanks,