Regular expression for no white space at start or end, but allow white space in middle, but also allow only one char inputs:
The closest I have got is : ^([^s])([sa-zA-Z0-9_-]*)([^s])$
The problem with this is that it will only pass if the input is three or more chars, I need it to accept a single char and pass. EG:
The following should pass (using " for easy of reading, not required in string)
"A"
"A B"
"Hello There"
The following should fail
" A"
"A "
" A "
" test"
also needs to only allow A-Z a-z 0-9 - _ though out, with addition of spaces in middle section but not at start or end
Any ideas?
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…