You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Ryan <sc...@efirstbank.com> on 2001/07/27 19:56:31 UTC

Validation REGEX for input

I don't know if this is the appropriate forum for this but I will ask
anyway.  I am trying to use the validation framework to validate an
input value.  I can't seem to come up with a REGEX mask that satisfies
the criteria.  

The input has the following criteria

1) 6-8 characters in length
2) At least one letter
3) At least one digit

I can't seem to get all of them to fire at once.   Any help would be
appreciated.

The validation framework has been extremely valuable and it has saved a
lot of development time on our side.


Scott Ryan
Developer
First Bank Data Corporation
Work: (303) 235-1485
Cell:    (303 263-3044

RE: Validation REGEX for input

Posted by Renzo Toma <re...@xs4all.nl>.
Hi Scott,

What about this little gem? Not sure if it works, but it looks sound:

^(.*\w.*\d.*|.*\d.*\w.*){6,8}$

for more control of valid characters you could use [...] charactersets:

^(.*[a-zA-Z].*[0-9].*|.*[0-9].*[a-zA-Z].*){6,8}$

Let me know if it works.


Cheers,


Renzo

-----Original Message-----
From: Scott Ryan [mailto:scott.ryan@efirstbank.com]
Sent: vrijdag 27 juli 2001 19:57
To: <
Subject: Validation REGEX for input


I don't know if this is the appropriate forum for this but I will ask
anyway.  I am trying to use the validation framework to validate an
input value.  I can't seem to come up with a REGEX mask that satisfies
the criteria.  

The input has the following criteria

1) 6-8 characters in length
2) At least one letter
3) At least one digit

I can't seem to get all of them to fire at once.   Any help would be
appreciated.

The validation framework has been extremely valuable and it has saved a
lot of development time on our side.


Scott Ryan
Developer
First Bank Data Corporation
Work: (303) 235-1485
Cell:    (303 263-3044