in reply to search for exact string
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
|
|---|