PDA

View Full Version : error checks


kathryn
04-17-2003, 03:43 PM
Hi,
I am trying to do some error checking on text fields on a html form
I need the check to be
digit 1 must be alpha
digit 2 alpha or numeric
and digit 3-8 numeric

I am using a sililar one like
var re = /^\w.\d{6}$/

which does alpha or numeric for 1-2
the numeric for 3-8
but i don't know how to adapt it for the check I described above??
Thanks, Kathryn

beetle
04-17-2003, 03:47 PM
You gotta make a character set. Those are delimited by []

/^\w[\w\d]\d{6}$/

kathryn
04-22-2003, 08:48 AM
The first digit must be alpha only not numeric this check allows either to be entered.

beetle
04-22-2003, 01:28 PM
oh ya, the \w is word characters, including 0-9

/^[a-z]\w\d{6}$/i

kathryn
04-22-2003, 01:34 PM
Thanks for that, Kathryn