Try this:
There might be something a bit more elegant than (?: (?! \S) | (?= [,;])) for the end delimiter, but it was a quick fix.c:\@Work\Perl\monks>perl -wMstrict -le "my $s = '.net, .net; C .NET Cobol .NET C++ .NET .NETER Perl IT x.NET +.net'; ;; for my $kw (qw(.NET C C++)) { my $count = () = $s =~ m{ (?<! \S) \Q$kw\E (?: (?! \S) | (?= [,;])) + }xmsig; print qq{'$kw' $count}; } " '.NET' 6 'C' 1 'C++' 1
Give a man a fish: <%-{-{-{-<
In reply to Re^5: Regex help \b & \Q
by AnomalousMonk
in thread Regex help \b & \Q
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |