No need to construct RegExp twice

This commit is contained in:
Michal Čihař 2012-04-25 10:19:22 +02:00
parent 09ae4e5fbc
commit 74b94394ce

View File

@ -102,7 +102,6 @@ function isDate(val,tmstmp)
var pos=2;
dtexp=new RegExp(/^([0-9]{4})-(((01|03|05|07|08|10|12)-((0[0-9])|([1-2][0-9])|(3[0-1])))|((02|04|06|09|11)-((0[0-9])|([1-2][0-9])|30)))$/);
if (val.length == 8) {
dtexp=new RegExp(/^([0-9]{2})-(((01|03|05|07|08|10|12)-((0[0-9])|([1-2][0-9])|(3[0-1])))|((02|04|06|09|11)-((0[0-9])|([1-2][0-9])|30)))$/);
pos=0;
}
if (dtexp.test(val)) {