Question

Consider the following Java code: import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexGroup {     public static void main(String[] args) {         String text = "Date: 2023-10-26, Time: 14:30";         Pattern pattern = Pattern.compile("(\\d{4})-(\\d{2})-(\\d{2})");         Matcher matcher = pattern.matcher(text);         if (matcher.find()) {             System.out.println(matcher.group(0) + " | " + matcher.group(1));         } else {             System.out.println("No match");         }     } } What will be the output of this program?

A 2023-10-26 | 2023
B 2023-10-26 | 10
C 2023-10-26 | 26
D No match
E 2023 | 10
Practice Next

Hey! Ask a query