Desired output : Java 1 8 true Output produced by this code Java 1 8 false what should be done to return true value ? the pattern of the input is [string] [dot][digit][dot][digit].
String st=java 1.8;
String regex="[\\s\\.]";
Pattern p=Pattern.compile(regex);
String []s2=p.split(st);
for(String a:s2)
System.out.println(a);
System.out.println(p.matches(st,regex));
} }