Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
127
rated 0 times [  133] [ 6]  / answers: 1 / hits: 31995  / 12 Years ago, thu, november 15, 2012, 12:00:00

I need help with regular expression.I need a expression in jquery which allows only character or space between two words. no double space allowed



I am using this



/^[a-zA-Z]+(-_ [a-zA-Z]+)*/


but it's not working.



Example
space hello - not allowed



hello space - not allowed



hello space space hello - not allowed



space hello space - not allowed



hello1234 - not allowed



hello space 1234 - not allowed






hello world-allowed



hello-allowed



hello how are you-allowed


More From » jquery

 Answers
14

you can use this



/^([a-zA-Z]+s)*[a-zA-Z]+$/

[#81981] Tuesday, November 13, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
neob

Total Points: 253
Total Questions: 106
Total Answers: 104

Location: Federated States of Micronesia
Member since Sun, May 16, 2021
3 Years ago
;