Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by vitoco (Pilgrim)
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 making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2014-07-26 02:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls