Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^5: Problems searching and highlighting proximity words in a text

by Krambambuli (Curate)
on May 24, 2010 at 12:05 UTC ( #841376=note: print w/replies, xml ) Need Help??


in reply to Re^4: Problems searching and highlighting proximity words in a text
in thread Problems searching and highlighting proximity words in a text

The $4 seems not to be necessary,

Indeed, as long as you use

(?:\w+\W+){0,$distance}

instead of the expression I've used,

(\w+\W+){0,$distance}

there will be no extra match. I haven't done any benchmarking, but probably the lookahead is a bit better/faster anyway.

  • Comment on Re^5: Problems searching and highlighting proximity words in a text

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://841376]
help
Chatterbox?
[holli]: what? the pm code you swindled your way into?
[LanX]: no already the pm code I'm allowed to see ... http://www. perlmonks.net/ index.pl?node_id= 1203338;style=css
[LanX]: understanding this code is like relearning space invaders and donkey Kong at the same time

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2017-11-20 21:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (294 votes). Check out past polls.

    Notices?