Pattern pat= Pattern.compile(".*[;./].*"); Matcher mat= pat.mat(strInput); if (!mat.matches()) { String[] pathArray= new String[3]; pathArray[0] = "/b