Ques 1 Regex
Which class is used to work with regular expressions in Java?
Ques 2 Regex
What will be the output of the following code snippet?
Pattern pattern = Pattern.compile("sc"); Matcher matcher = pattern.matcher("scode"); System.out.println(matcher.find());
Ques 3 Regex
Which method is used to replace occurrences of a regex pattern with a specified string in Java?
Ques 4 Regex
What will be the output of the following Java code snippet?
Pattern pattern = Pattern.compile("\\d+"); Matcher matcher = pattern.matcher("1234"); while (matcher.find()) { System.out.print(matcher.group() + " "); }
Ques 5 Regex
What is the metacharacter used to match zero or one occurrence of the preceding character in a regex pattern in Java?