Advertisement

11.29.2007 at 07:19PM PST, ID: 22992356
[x]
Attachment Details

How to get total length of a complex regular expression

Asked by gromul in Regular Expressions

I have a validation expression that doesn't accept the @ character and can't be all numbers:
First part: accept 0 or more non-@ chars
Second part: accept 1 or more non-@ and non-numeric chars (guarantees no pure-numeric inputs)
Third part: accept 0 or more non-@ chars

^(?#Exclude @)([^@]*)(?#Exclude @ AND NUM)([^@0-9]+)(?#Exclude @)([^@]*)$

Is there a way to also restrict total length of the expression: i.e. input of length more than 10 is invalid? Or is there a good way to rewrite my expression so I can just use {1,10}?

ThanksStart Free Trial
 
Loading Advertisement...
 
[+][-]11.29.2007 at 07:41PM PST, ID: 20379680

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.

 
[+][-]11.29.2007 at 08:33PM PST, ID: 20379890

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.

 
[+][-]11.30.2007 at 05:36AM PST, ID: 20381751

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

Zone: Regular Expressions
Sign Up Now!
Solution Provided By: ddrudik
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628