You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by RD...@quickhire.com on 2004/06/14 21:43:09 UTC

[OT]Help needed in wring regular expression

Hi,
Web page contains a text box can accept only maximum of four digits and it
can be integers/String(accepts only "many","MANY") if enter a single integer
value it should not be 0(zero) and 0(zero) can be entered subsequently after
first non-zero integer and totally 4 digit maximum. 

I tried using "(\d(1)?[1-9]{1,4})|(FEW)|(few)|(MANY)|(many)" to avoid
entering 0 as first value but it fails if we enter "00","000""0000" + I
could not restrict the size to be 4 digit max when I tried to enter more
than a digit.

Can anybody help me to write regular expression for the above conditions or
any sample example code for the above case or any suggestions.

Thanks in advance.
-Ram


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT]Help needed in wring regular expression

Posted by Navjot Singh <na...@net4india.net>.
but you can achieve your objective in 2 easy regex.

Anyway can you try something like this
(\d(1)[^0])|(\d(1)\d(1)[0-9]{1,3})|(FEW)|(few)|(MANY)|(many)

<navjot/>

RDoss@quickhire.com wrote:

> Hi,
> Web page contains a text box can accept only maximum of four digits and it
> can be integers/String(accepts only "many","MANY") if enter a single integer
> value it should not be 0(zero) and 0(zero) can be entered subsequently after
> first non-zero integer and totally 4 digit maximum. 
> 
> I tried using "(\d(1)?[1-9]{1,4})|(FEW)|(few)|(MANY)|(many)" to avoid
> entering 0 as first value but it fails if we enter "00","000""0000" + I
> could not restrict the size to be 4 digit max when I tried to enter more
> than a digit.
> 
> Can anybody help me to write regular expression for the above conditions or
> any sample example code for the above case or any suggestions.
> 
> Thanks in advance.
> -Ram
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> .
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org