Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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.


Comment on Re: Filtering Source Text File with 2nd Text File of Terms
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://963286]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (15)
As of 2014-09-23 15:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (224 votes), past polls