javascript - Regex for a special character with only space as a chracter -


i have jquery plugin allow/not allow special characters , have been using regex method allow special characters -_*@#$%&,."\'?;:

but don't want allow special characters white space special character. how can achieve using regex method.

if need match regular space ' ' can escape space character '\ '. if need match whitespace character can use special character \swhich match whitespace character such space ' ', tab \t, newline \n or carriage return \r.

check following examples.

regular spaces /\ /g: http://regexr.com/3gng6

any whitespace character /\s/g: http://regexr.com/3gng3


Comments