Hi try this,
use strict; my $toFind="String"; while(<DATA>){ my $line=$_; chomp($line); if($line=~m/\b$toFind(?=[^\w\.]+|$)/i){ print "$line\n"; } }
__DATA__ blah blah string blah important stringstuff we wish to keep Unimportant string more stuff we wish to String.o Some more unimportant String.c
Punitha
In reply to Re: search for exact string
by Punitha
in thread search for exact string
by gfarhat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |