10
I have the following return:
EXCEPTION,Classexception,EXCEPTION,
I’d like to take the amount of times that String appears EXCEPTION
using Regex.
I used the following code:
Pattern.compile("(EXCEPTION)",Pattern.DOTALL).matcher(aString).groupCount()
But the same returns to me 1
. Someone knows what can be done?
Note: I know it is possible to perform the parse and count the amount in a loop.
Is there any better way than I mentioned to solve this problem?
This Stringutils class is of which package?
– fymoribe
I added in response!
– Kenny Rafael
Thank you, I used Stringutils.countOccurrencesOf from the org.springframework.util.Stringutils package.
– fymoribe
Orders!!!
– Kenny Rafael