regex for username validation code example
Example: regex for username
let username = '';
username = username.replace(/\s/g,'_');
username = username.replace(/\-/g,'.');
username = username.match(/[a-zA-Z0-9\.\s]+/g).join('_');
let username = '';
username = username.replace(/\s/g,'_');
username = username.replace(/\-/g,'.');
username = username.match(/[a-zA-Z0-9\.\s]+/g).join('_');