Philipp Gruemmer wrote: > Hello Gary, > >> [gary@gary gary]$ cat t >> #!/usr/bin/perl -w >> >> my @input=('one','two','three'); >> my @blacklist=('two','four'); >> >> foreach $line (@input) { >> foreach $cond (@blacklist) { >> print "$line=$cond..."; >> if ($line=~/$cond/) { >> print "true\n"; >> last; >> } >> print "false\n"; >> } >> } >> [gary@gary gary]$ > > This comes very close. But it doesn't seem to find *any* occurence of > the searched string. Only those that stand 'alone'. How do I match > these (assuming the string to find ist 'test')? > > ldjtestödsfllöf > ^^^^ > test > jsdfkjsh test sldflösdfk > lödskföldtest > ^^^^ > testösldfkdlfk > > which actually means *any* line containing the string 'test'... > > I tried /.+test.+/ so far, but it doesn't seem to work here... If you are only looking for test then /test/ will work and I tried it on my system with the data above and then made changes to the data and it still worked as I would have expected. Your /.+test.+/ will work as long as it is surrounded by sometype of data. The .+ says at least ONE or more. So test by itself will fail. Test at the beginning or end of line will fail. if /test/ is failing on the data you have above, then we need to see your script because it should work for everything you have above by just using /test/.
Wags ;) ********************************************************** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. **************************************************************** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]