in reply to Re^2: Regex help \b & \Q
in thread Regex help \b & \Q
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: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Regex help \b & \Q
by Anonymous Monk on Apr 14, 2016 at 12:17 UTC | |
by ikegami (Patriarch) on Apr 14, 2016 at 18:29 UTC | |
by AnomalousMonk (Archbishop) on Apr 14, 2016 at 19:43 UTC | |
by rsFalse (Chaplain) on Apr 14, 2016 at 20:07 UTC | |
by AnomalousMonk (Archbishop) on Apr 14, 2016 at 20:51 UTC | |
by rsFalse (Chaplain) on Apr 15, 2016 at 10:18 UTC | |
| |
by AnomalousMonk (Archbishop) on Apr 14, 2016 at 12:43 UTC |