0

My code is:

Pattern pattern = Pattern.compile("[A|AB|ABC]");
Matcher matcher = pattern.matcher("ABC");
System.out.println(matcher.group());`

The Stdout output is: A

But I want it to print "ABC" since ABC is the longest match.

0 Answers0