Regex to check if string contains Alphanumeric Characters and Spaces only
- javascript
This is what I have so far:
function checkTitle(){
reg = /^[\w ]+$/;
a = reg.test($("#title").val());
console.log(a);
}
So far in my tests it catches all special characters except _. How do I
catch all special characters including _ in the current function?
I need the string to only have Alphanumeric Characters and Spaces.
Appreciate the help cause I have yet to fully understand regex patterns.
Thanks!
No comments:
Post a Comment