Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

username regex

/^[a-zA-Z0-9_-]{3,16}$/
Comment

username regex

^(?=[a-zA-Z0-9._]{8,20}$)(?!.*[_.]{2})[^_.].*[^_.]$
Comment

regex for username

# works in most newer browsers
^(?=.{8,20}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._]+(?<![_.])$
 └─────┬────┘└───┬──┘└─────┬─────┘└─────┬─────┘ └───┬───┘
       │         │         │            │           no _ or . at the end
       │         │         │            │
       │         │         │            allowed characters
       │         │         │
       │         │         no __ or _. or ._ or .. inside
       │         │
       │         no _ or . at the beginning
       │
       username is 8-20 characters long

# works in all browsers, but does the same as the above RegEx
^(?=[a-zA-Z0-9._]{8,20}$)(?!.*[_.]{2})[^_.].*[^_.]$
Comment

regex for username

let username = '';
username = username.replace(/s/g,'_');
username = username.replace(/-/g,'.');
username = username.match(/[a-zA-Z0-9.s]+/g).join('_');
Comment

simple username regex

^[A-Za-z][A-Za-z0-9_]{2,16}$
Comment

regex for good username

let userCheck = /^[a-z][a-z]+d*$|^[a-z]dd+$/i;
Comment

PREVIOUS NEXT
Code Example
Javascript :: $ is not defined 
Javascript :: stop settimeout 
Javascript :: javascript trigger button click using class name 
Javascript :: import angular flex layout 
Javascript :: how to check if 2 images are touching js 
Javascript :: regex cnpj javascript 
Javascript :: npm err! 503 service unavailable proxy 
Javascript :: fibonacci js code 
Javascript :: enzyme check state 
Javascript :: generate random string in javascript 
Javascript :: send a message to a specific channel discord.js 
Javascript :: how to hash password in node js 
Javascript :: js tolocalestring with hours 
Javascript :: htaccess for react 
Javascript :: for loop display array 
Javascript :: google charts hide legend 
Javascript :: remove bearer from token in node js 
Javascript :: get the last option from select jquery 
Javascript :: react get input value on button click functional component 
Javascript :: javascript detect video end 
Javascript :: javascript removing items looping through array 
Javascript :: jquery selected option 
Javascript :: js get current date 
Javascript :: how to find the width of outerconatiner in react native 
Javascript :: js does array.map maintain the order 
Javascript :: js touchmove get client position 
Javascript :: Could not find router reducer in state tree, it must be mounted under "router" 
Javascript :: angular input date binding on variable update 
Javascript :: next js next/head head 
Javascript :: react native gradient touchable feedback 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =