日期:2014-05-20 浏览次数:20679 次
public class RegexTest {
//http://bbs.csdn.net/topics/390337220
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(("23:27").matches("([01]\\d)
------解决方案--------------------
([2][0123]):[0-5]\\d"));
System.out.println(("13:27").matches("([01]\\d)
------解决方案--------------------
([2][0123]):[0-5]\\d"));
System.out.println(("23:27").matches("([01]\\d
------解决方案--------------------
[2][0123]):[0-5]\\d"));
System.out.println(("13:27").matches("([01]\\d
------解决方案--------------------
[2][0123]):[0-5]\\d"));
System.out.println(("23:27").matches("(([01]\\d)
------解决方案--------------------
([2][0123])):[0-5]\\d"));
System.out.println(("13:27").matches("(([01]\\d)
------解决方案--------------------
([2][0123])):[0-5]\\d"));
//以上不懂啊
System.out.println(("04:27").matches("(0[0-3]
------解决方案--------------------
1\\d):[0-5]\\d"));
System.out.println(("23:27").matches("(0[0-3]
------解决方案--------------------
1\\d):[0-5]\\d"));//3楼的
}
}
/*
true
false
true
true
true
true
false
false
*/