[thelist] RegEx problem again

Tom Dell'Aringa pixelmech at yahoo.com
Mon Aug 8 10:14:18 CDT 2005


Last week you all helped me with a regex I thought I had licked, but turns up there is a problem.
I can't quite figure it out as usual. To refresh, I have a customer name field that requires:

- Minimum 3 characters
- Only alpha characters
- Can include a wildcard character of '*' (in which case you would require 4 characters)

To that end I had this:

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

Which worked just fine, till we realized we need to allow one or more SPACES as well! How do you
add a space to the pattern? (and allow for as many spaces as they like?)

TIA

Tom


http://www.pixelmech.com/

Melissa: Ace, Where are you?
Ace Ventura: I'm in Psychoville and Finkle's the Mayor.



More information about the thelist mailing list