Java pattern matching
Properties properties = System.getProperties();
properties.list(System.out);
String osname = (String)properties.get("os.name");
System.out.println("osname="+osname);
Pattern pat = Pattern.compile("Windows", Pattern.CASE_INSENSITIVE);
Matcher mat = pat.matcher(osname);
System.out.println("Looking for windows in windows xp.");
if (mat.find())
System.out.println("subsequence found");
else
System.out.println("No Match");
Comments