Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Filtering Source Text File with 2nd Text File of Terms

by vitoco (Friar)
on Apr 03, 2012 at 17:53 UTC ( #963286=note: print w/replies, xml ) Need Help??


in reply to Filtering Source Text File with 2nd Text File of Terms

Please note that unescaped special characters in strings used as patterns could give unpredictable results!!!

Example: the term "www.thisisannoying.com" will also match lines with "wwwithisisannoyingacom"...

If the terms from the list are single words, probably the test from previous posts should be:

print "$source\n" unless grep { $source =~ /\b$_\b/ } @terms;

where \b is used to check for word boundaries, so "googleeee" won't be matched by "google" term.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://963286]
help
Chatterbox?
[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
[holli]: i saw that thread and figured it`s OPP value too high. i didnt realise its PM code

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2017-11-20 21:37 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?