Question : alphanumeric with space regex
Answered by : grieving-gharial-54afdxs4rdwl
var regex = new RegExp("^[A-Za-z0-9? ,_-]+$"); var key = String.fromCharCode(event.charCode ? event.which : event.charCode); if (!regex.test(key)) { event.preventDefault(); return false; }
Source : https://stackoverflow.com/questions/13283470/regex-for-allowing-alphanumeric-and-space | Last Update : Mon, 28 Jun 21
Question : regular expression not to allow space in javascript
Answered by : indian-gooner
var regexp = /^\S*$/; // a string consisting only of non-whitespaces
Source : https://stackoverflow.com/questions/16334765/regular-expression-for-not-allowing-spaces-in-the-input-field | Last Update : Thu, 10 Dec 20