String sftimeString="^[0-9]*:[0-9]*:[0-9]*$"; Pattern pattern=Pattern.compile(sftimeString); if(pattern.matcher(jtxx.getSc()).matches()){ //匹配后的逻辑 }