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?