We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to use Regex.Matches().count

I am not able to import Ragex and matches.please help me to solve this.
int totalCount = Regex.Matches(plainText, toBeMatched ).Count;


Thanks for your inquiry. Please use the following code to get desired results. Hope, this helps.

String plainText = doc.getRange().getText();
String toBeMatched = "Aspose.Words";

Pattern pattern = Pattern.compile(toBeMatched);
Matcher matcher = pattern.matcher(plainText);
int count = 0;
while (matcher.find()) {
System.out.println("Total Count is: " + count);