Noting specifically that you have asked to match for the exact string "String" (rather than a case-insensitive match), this should work:
#!/usr/bin/perl -w use strict; my $toFind="String"; for (<DATA>){ print if /$toFind(?!\.[oc])\b/; } __DATA__ this is a String strings are us String.c is a file so string.o is too I like a good STRING now and again
In reply to Re: search for exact string
by oko1
in thread search for exact string
by gfarhat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |