About Question enthuware.ocpjp.v7.2.1415 :
Posted: Wed Feb 26, 2014 12:03 pm
Hi,
this should match all propositions
because the . (dot) matches any single character (except the newline character), hence including the white space
I tested with the following code
public static void main(String[] args) {
String str1 = "CooLooLCuuL";
String str2 = "CooLooL and CuuL";
String str3 = "CooL and CuuL";
Pattern pattern = Pattern.compile("C.*L");
Matcher matcher = pattern.matcher(str3);
while (matcher.find()) {
System.out.println(matcher.start() + " " + matcher.group());
}
}
Viet
this should match all propositions
because the . (dot) matches any single character (except the newline character), hence including the white space
I tested with the following code
public static void main(String[] args) {
String str1 = "CooLooLCuuL";
String str2 = "CooLooL and CuuL";
String str3 = "CooL and CuuL";
Pattern pattern = Pattern.compile("C.*L");
Matcher matcher = pattern.matcher(str3);
while (matcher.find()) {
System.out.println(matcher.start() + " " + matcher.group());
}
}
Viet