[thelist] validation expression help
Andrew Clover
and-evolt at doxdesk.com
Wed Dec 29 20:00:38 CST 2004
Casey Crookston <casey at thecrookstons.com> wrote:
> ValidationExpression="\d{1}/\d{1}/\d{4}"
> How do you build an option into the expression to allow 1 or 2 numbers?
\d{1,2}/\d{1,2}/\d{4}
However if that's a JavaScript string remember the blackslashes are
escapes in string literals too, so you have to escape them again:
var expr= '\\d{1,2}/\\d{1,2}/\\d{4}';
var re= new RegExp(expr);
Also that's a potentially confusing date format (is it d/m/y or m/d/y?).
Suggest picking another, maybe ISO (yyyy-mm-dd)?
--
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/
More information about the thelist
mailing list