microkarl Posted November 20, 2009 Posted November 20, 2009 Hi all, I want to enhance this regular expression - ^[0-9a-zA-Z]{6,20}$ to not allow any spaces (leading, in between, and trailing). I know the regexp for space is (\s*), but just don't know how to put them together. Can any one help? Regards, Kyle Quote Donald DUCK : YOU ARE FIRED!!!
Leaders Iceplug Posted November 20, 2009 Leaders Posted November 20, 2009 I put it after the 9 and it seems to work ^[A-Za-z0-9\s]{6,20}$ Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
microkarl Posted November 24, 2009 Author Posted November 24, 2009 Iceplug, thanks for your respond. It doesn't work. It works like this: - "Test1" - no match (expected) - "Test1 " - no match (expected) - "Test123" - match (expected) - "Test123 " - match (not expected) Basically, if I have string is less than 6 characters, regardless the spaces, it should fail. But as long as the string is with 6-20 chars. the regex allows spaces. which is not allowed. Can you help? Thanks. carl Quote Donald DUCK : YOU ARE FIRED!!!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.