Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > RegularExpession Validator

Reply
Thread Tools

RegularExpession Validator

 
 
fdisk
Guest
Posts: n/a
 
      06-10-2004
Oh great Regular Expression gurus - I summon thee...

I know this is probably about as trivial as it gets for someone with
regular expression experience, but I don't. I was wondering if
someone would be able to create a regular expression (for validating
user passwords) that matches the following:

All of the following must be true for a match:

6-12 length - Isn't it something like {6,12}
Must include 1 or more lowercase - [a-z]
Must include 1 or more uppercase - [A-Z]
Must include 1 or more numeric - [0-9]

That's it, from the little I know, those are the patterns that it
should use, but I have no idea how to create the full statement.

TIA!

JB
 
Reply With Quote
 
 
 
 
stuart
Guest
Posts: n/a
 
      06-10-2004
Hi there,

I ain't no guru and may be slapped down, but I don't think you can do all that in validation controls. I would simply use a label control and activate a custom validation function when then page is posted back, all of what you said is dead easy with strings.

cya

"fdisk" wrote:

> Oh great Regular Expression gurus - I summon thee...
>
> I know this is probably about as trivial as it gets for someone with
> regular expression experience, but I don't. I was wondering if
> someone would be able to create a regular expression (for validating
> user passwords) that matches the following:
>
> All of the following must be true for a match:
>
> 6-12 length - Isn't it something like {6,12}
> Must include 1 or more lowercase - [a-z]
> Must include 1 or more uppercase - [A-Z]
> Must include 1 or more numeric - [0-9]
>
> That's it, from the little I know, those are the patterns that it
> should use, but I have no idea how to create the full statement.
>
> TIA!
>
> JB
>

 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      06-11-2004
Try this?

"^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,12}$"

Modified from this:

http://regexlib.com/REDetails.aspx?regexp_id=598

Ken


"fdisk" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Oh great Regular Expression gurus - I summon thee...
>
> I know this is probably about as trivial as it gets for someone with
> regular expression experience, but I don't. I was wondering if
> someone would be able to create a regular expression (for validating
> user passwords) that matches the following:
>
> All of the following must be true for a match:
>
> 6-12 length - Isn't it something like {6,12}
> Must include 1 or more lowercase - [a-z]
> Must include 1 or more uppercase - [A-Z]
> Must include 1 or more numeric - [0-9]
>
> That's it, from the little I know, those are the patterns that it
> should use, but I have no idea how to create the full statement.
>
> TIA!
>
> JB


 
Reply With Quote
 
fdisk
Guest
Posts: n/a
 
      06-11-2004
"Ken Cox [Microsoft MVP]" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> Try this?
>
> "^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,12}$"
>
> Modified from this:
>
> http://regexlib.com/REDetails.aspx?regexp_id=598
>
> Ken


Thanks for the response Ken, I did check out that regex before, even
tried the tester on the website - it doesn't appear to match
upper-case. For instance "testtest" fails, but "testtest12" matches.
It's even funkier in the regularexpression validator control, where I
could never get it to pass...

Here is my aspx code - any ideas what I am doing wrong?

<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator id="RegularExpressionValidator1"
runat="server" ErrorMessage="RegularExpressionValidator" ControlToValidate="TextBox1"
ValidationExpression="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,12}$"></asp:RegularExpressionValidator>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Struts Validator - creditCard validator smrimell@gmail.com Java 4 02-13-2007 08:32 PM
Where to find Validator component in Visual Studio.NET jacksu MCSD 2 02-20-2004 04:56 PM
how to connect a validator programmatically to a bound datagrid Mark Kamoski ASP .Net 0 07-16-2003 10:19 PM
Validator controls and usercontrols Antonio Maciel ASP .Net 0 07-09-2003 12:34 PM
Custom Validator Serdar Kalaycę ASP .Net 1 07-08-2003 01:36 PM



Advertisments