本帖最后由 许庭洲 于 2012-7-31 09:21 编辑
前台采用JavaScript技术
<script type="text/javascript">
function testReg(reg,str)
{
return reg.test(str);
}
var reg = /^\d{4}-\d{1,2}-\d{1,2}$/;
var str = '2008-8-8';
var str2 = '2008-08-08';
var str3 = '08-08-2008';
var str4 = '2008 08 08';
document.write(testReg(reg,str)+'<br />');
document.write(testReg(reg,str2)+'<br />');
document.write(testReg(reg,str3)+'<br />');
document.write(testReg(reg,str4)+'<br />');
</script> |