Regular expression for only alphabet and number but not space
<p>I have a input text box in angular js which need to accept only alphabets and numbers but not special character as well as spaces.</p>

<p>For that I am using <code>"^[a-zA-Z0-9]+$"</code> but its not working as i am expecting.</p>

<p>$error is only for special symbol but not for spaces. what i am doing wrong here please help.</p>

<p>I have read some people has used " " in Regex but its to allow space.</p>