1. 程式人生 > >校驗日期格式

校驗日期格式

日期格式為:HH:mm HH:00:24 mm:00/30
正則表示式:

reg="^(([0-1][0-9]|2[0-4])):([30][00])$"

以下是method

public  boolean validate(String reg,String str){
   Pattern p = Pattern.compile(reg);
   Matcher matcher=p.matcher(str);
   return matcher.matches();
}