Advertisement

09.21.2007 at 02:59PM PDT, ID: 22845482
[x]
Attachment Details

Regex to check for 2 non alpha-numeric characters and the whole string at least 5 characters long

Asked by Gewgala in Microsoft Visual C#.Net, C# Programming Language, Programming for ASP.NET

Tags: , , , ,

I need a regular expression for ASP.NET C# to check and make sure that there are at least 2 non alpha-numeric characters and that the whole string is at least 5 characters long.  How do I do that?  I have been at this for a long time, and this is the closest I can get:

(.*)([\\W].*?[\\W])(.*)

That will make sure that there are at least 2 non alpha-numeric characters in the string, in no particular order just somewhere in the string, which is what it needs to do, but it doesn't guarantee that there will be at least 5 characters.

Something simple like this:     .....*?[\\W]  guarantees that there will be at least 5 characters but that way you HAVE to put the non alpha-numeric on the end, which is no good.  Anybody have any ideas?Start Free Trial
[+][-]09.21.2007 at 04:41PM PDT, ID: 19939869

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.21.2007 at 05:12PM PDT, ID: 19939960

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.21.2007 at 08:05PM PDT, ID: 19940413

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual C#.Net, C# Programming Language, Programming for ASP.NET
Tags: check, alpha, numeric, regex, characters
Sign Up Now!
Solution Provided By: FernandoSoto
Participating Experts: 3
Solution Grade: A
 
 
[+][-]09.22.2007 at 11:11AM PDT, ID: 19942191

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.22.2007 at 12:55PM PDT, ID: 19942453

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.22.2007 at 01:53PM PDT, ID: 19942583

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.22.2007 at 02:55PM PDT, ID: 19942755

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.22.2007 at 04:20PM PDT, ID: 19942931

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.22.2007 at 08:29PM PDT, ID: 19943374

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.22.2007 at 11:29PM PDT, ID: 19943646

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.23.2007 at 08:41AM PDT, ID: 19944558

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09.24.2007 at 08:39AM PDT, ID: 19949174

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.24.2007 at 09:47AM PDT, ID: 19949649

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_1_20070628