Regular Expression for dd-MMM-yyyy format for validator in asp.net 2.0
ValidationExpression="^([012]?\d3[01])-([Jj][Aa][Nn][Ff][Ee][bB][Mm][Aa][Rr][Aa][Pp][Rr][Mm][Aa][Yy][Jj][Uu][Nn][Jj][u]l[aA][Uu][gG][Ss][eE][pP][oO][Cc][tT][Nn][oO][Vv][Dd][Ee][Cc])-(1920)\d\d$"
Same can be incorporated in javascript
_function _checkISValidDate(checkobject)
{
_var -strRegs = _new
_RegExp("^([012]?\\d3[01])-([Jj][Aa][Nn][Ff][Ee][bB][Mm][Aa][Rr][Aa][Pp][Rr][Mm][Aa][Yy][Jj][Uu][Nn][Jj][u]l[aA][Uu][gG][Ss][eE][pP][oO][Cc][tT][Nn][oO][Vv][Dd][Ee][Cc])-(1920)\\d\\d$");
_if(!_checkobject.value.match(_strRegs))
{
_alert("Enter Date in dd-MMM-yyyy format");
_checkobject.focus();
_return false;
}
}
About javascript reguar expressions:
http://www.regular-expressions.info/javascriptexample.html
Tuesday, July 03, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment