Input pattern for text box for validation

I have an html line:

<td><img src="images/req.jpg" alt="*">Customer ID (acct/track):&nbsp;&nbsp;&nbsp;<input type="text" ID="customerID" NAME="customerID" style="width:80px" value=<% =customerID %> onclick="return customerID_onclick()"></td>


What I would like to do is add a "input pattern"  
validation pattern with this textbox ?

or maybe its a seperate line:


using this regex.
(?=^.{3,9}$)[1-9A-Z]((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z]).*$

Thanks
Fordraiders
LVL 3
FordraidersAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Do you mean something like this
<input type="text" pattern="(?=^.{3,9}$)[1-9A-Z]((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z]).*$" name="customerID" />

Open in new window

FordraidersAuthor Commented:
julian , but also keep the previous "style" and "width" from above ?
Julian HansenCommented:
td><img src="images/req.jpg" alt="*">Customer ID (acct/track):&nbsp;&nbsp;&nbsp;<input type="text" ID="customerID" NAME="customerID" style="width:80px" value=<% =customerID %> onclick="return customerID_onclick()" pattern="(?=^.{3,9}$)[1-9A-Z]((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z]).*$"/></td>

Open in new window

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

FordraidersAuthor Commented:
Julian,
this pattern, is taking leading zeros..
I just tested on regex.
Julian HansenCommented:
See my sample here

Does not allow leading 0's
FordraidersAuthor Commented:
Julian Sorry, For the misunderstanding...

Min and Total characters(alpha or numeric) :  3 to  9  

The patterns
Are:
Position1: CAN NOT START WITH ZERO
<A-Z or 1-9>
ANY characters after that can be:
<A-Z or 1-9>

I.E.
9A272
EEEEE
1232232345
2E2324444
E3RRR
12WSDC
888888888T
188888888T
EE22222WW
Julian HansenCommented:
Position1: CAN NOT START WITH ZERO
Yes I understand. The code does not allow it to
If you go to the sample and enter this
09Aye!22
You get a red border around the box
If you enter this
19Aye!22
You don't

Now, to the requirement, based on the original pattern you posted I assumed you wanted the other characters - based on your above examples the expression is trivial
[1-9A-Z] - first char must be 1-9A-Z
[0-9A-Z] - Any digit or capital letter
{2,8}  - 2 - 8 of them - we already checked the first one.
<input type="text" pattern="[1-9A-Z][0-9A-Z]{2,8}$" name="password" />

Open in new window

The question is - must it be invalid if there are lower case / non-alphas in the string after position 0?
FordraidersAuthor Commented:
just lower case is not valid.
non-alphas after position is ok..
Julian HansenCommented:
Try this one then (added non alpha's)
<input type="text" pattern="[1-9A-Z][1-9A-Z\W]{2,8}$" name="password" />

Open in new window

Sample updated.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FordraidersAuthor Commented:
Thanks for all the help !!
Julian HansenCommented:
You are most welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.