void () { final String s89 = "class X {{ a = 1; b = 2; c=3; }}"; assertEquals("backtracking greedy regexp", 1, findMatchesCount(s89, "{ '_T*; '_T2*; }")); assertEquals("backtracking greedy regexp 2", 1, findMatchesCount(s89, " { '_T*; '_T2*; '_T3+; } ")); assertEquals("backtracking greedy regexp 3", 0, findMatchesCount(s89, " { '_T+; '_T2+; '_T3+; '_T4+; } ")); assertEquals("counted regexp (with back tracking)", 1, findMatchesCount(s89, " { '_T{1,3}; '_T2{2,}; } ")); assertEquals("nongreedy regexp (counted, with back tracking)", 1, findMatchesCount(s89, " { '_T{1,}?; '_T2*?; '_T3+?; } ")); assertEquals("nongreedy regexp (counted, with back tracking) 2", 0, findMatchesCount(s89, " { '_T{1,}?; '_T2{1,2}?; '_T3+?; '_T4+?; } ")); String s1000 = """ class A { void _() {} void a(String in, String pattern) {} }"""; String s1001 = """ class '_Class { '_ReturnType 'MethodName ('_ParameterType '_Parameter* ); }"""; assertEquals("handling of no match", 2, findMatchesCount(s1000,s1001)); }