[thelist] RegEx problem again

Frank lists at frankmarion.com
Mon Aug 8 11:18:30 CDT 2005


At 11:34 AM 2005-08-08, you wrote:
>Just add a space to the character sets, so [a-zA-Z] becomes [a-zA-Z ].  Note
>the space before the closing square bracket.


 > var namematch = /^[a-zA-Z]{3,}$/.test(nametext.value);
 > namematch = (namematch  || /^[a-zA-Z\*]{4,}$/.test(nametext.value));

That's right

 > var namematch = /^[a-zA-Z ]{3,}$/.test(nametext.value);
 > namematch = (namematch  || /^[a-zA-Z\* ]{4,}$/.test(nametext.value));

By the way, if your quantifyer "{3,}" has a comma, it means between 
(quantity) and unlimted times, it becomes greedy--it will return as many as 
it can. If you remove the comma, then it is the exact quantity of (quantity).



Frank Marion     lists at frankmarion.com      Keep the signal high.





More information about the thelist mailing list