Регулярен израз за име на потребителя

Примерен код

1
0

регулярен израз за име на потребителя

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

<html>
<head>
	<title></title>
</head>
<body>
<form method="post" action="">
	username:<input type="text"  id="name" onkeyup="validation()">
	</form>
</body>
<script type="text/javascript">
	function validation(){
	var username=document.getElementById("name").value;///get id with value 
	var usernamepattern=/^[A-Za-z .]{3,15}$/;////Regular expression
	if(usernamepattern.test(username))
	{
		document.getElementById("name").style.backgroundColor='yellow';
    }
    else
    {
    	document.getElementById("name").style.backgroundColor='red'; }
	}

</script>
</html>
0
0

проверка на потребителско име

<html>
<head>
	<title></title>
</head>
<body>
<form method="post" action="">
	username:<input type="text"  id="name" onkeyup="validation()">
	</form>
</body>
<script type="text/javascript">
	function validation(){
	var username=document.getElementById("name").value;///get id with value 
	var usernamepattern=/^[A-Za-z .]{3,15}$/;////Regular expression
	if(usernamepattern.test(username))
	{
		document.getElementById("name").style.backgroundColor='yellow';
    }
    else
    {
    	document.getElementById("name").style.backgroundColor='red'; }
	}

</script>
</html>
0
0

регулярен израз за име на потребителя

# 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})[^_.].*[^_.]$
0
0

регулярен израз на името на потребителя

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

Подобни страници

Подобни страници с примери

На други езици

Тази страница на други езици

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Íslensk
..................................................................................................................