I have a username field in my form. I want to not allow spaces anywhere in the string. I have used this regex:
var regexp = /^S/;
This works for me if there are spaces between the characters. That is if username is ABC DEF
. It doesn't work if a space is in the beginning, e.g. <space><space>ABC
. What should the regex be?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…