Pattern p1 = Pattern.compile("[0-9]*"); Matcher m1 = p1.matcher("100.0"); boolean bool=m1.find(); if(bool){ System.out.println(m1.group()); }