regex for usernae code example
Example 1: regex for username
let username = '';
username = username.replace(/\s/g,'_');
username = username.replace(/\-/g,'.');
username = username.match(/[a-zA-Z0-9\.\s]+/g).join('_');
Example 2: username regex
^(?=[a-zA-Z0-9._]{8,20}$)(?!.*[_.]{2})[^_.].*[^_.]$