in reply to all occurences of a target word by regular expression
Adapt your regex to suit. though I also have a problem seeing how you are count occurrences aboveperl -e '$string="apples and oranges are both fruit but I much prefer +apples"; @count=$string=~m/apple/g; print "\nThere are ", scalar @count," occurrences of the word apple in + the string\n";' There are 2 occurrences of the word apple in the string
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: all occurences of a target word by regular expression
by johngg (Canon) on Mar 30, 2010 at 21:41 UTC |