I tried to do this Codecademy’s challenge called “Determine the number of substrings that meet specific criteria. Part 2”. I attempted to accomplish the task by employing Pattern and Matcher objects, but it doesn’t work. Could you please tell me why?
public static int findNumValues(String text, String findText) {
int count = 0;
Pattern pattern = Pattern.compile(text.toLowerCase());
Matcher matcher = pattern.matcher(findText.toLowerCase());
while (matcher.find()) count++;
return count;
}