I am interesting in finding the number of times a word appears in a String.
I have seen the example of SUN Matcher Demo using the matcher (constructs a regex and counts the groups).
I was interested if this is the only way or there is something else like e.g.
Regex.Matches( input, "true" ).Count in C# (from SO question).
Or in my context:
If I am in a loop using contains
to check if certain words in the List
appear in the String
is there a simple/elegant way to get (on the spot??) the number of times the word occurs (that I already know it exists)?