Reputation: 833
I use ^$|^[^\s]+(\s+[^\s]+)*$
to achieve:
But how can I put the quantifiers to limit character count in between 6 - 20?
The following should pass
"" <-- (empty string)
"中文" <-- ( any character)
"A B" <-- (allow space in middle)
"hi! Hello There"
The following should fail
"A" <-- (less than 2 number of characters)
" AB" <-- (space at the start)
"AB " <-- (space at the end)
" AB "
"test test test test test test" <--- (more than 20 characters included spaces)
Thanks!
Upvotes: 5
Views: 6499