If whitespace or start/end of string is going to be the delimiter, I would use:
c:\@Work\Perl\monks>perl -wMstrict -le "my $title = 'C .NET Cobol .NET .NET .NETER Perl C++ C+ xC++ C+++ C++x + xC x.NET .net'; ;; for my $kw (qw(.NET C C++)) { my $count = () = $title =~ m{ (?<! \S) \Q$kw\E (?! \S) }xmsig; print qq{'$kw' $count}; } " '.NET' 4 'C' 1 'C++' 1
Give a man a fish: <%-{-{-{-<
In reply to Re^3: Regex help \b & \Q
by AnomalousMonk
in thread Regex help \b & \Q
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |