本文介绍了用户名不能包含重复下划线或句点可以以下划线开头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

建议用户名的正则表达式,它接受允许小写,大写,数字和下划线的输入。用户名可以以字母或下划线开头。下划线不得位于字符串的末尾。我不希望用户名包括两个连续的下划线。



我尝试过:



[_a-zA-Z0-9] [a-zA-Z0-9] + _?[a-zA-Z0-9] +



但是用户名失败的问题a_9

suggest an regex for username which takes input that allows lower case, upper case, numbers, and underscores. The username can start with alphabets or underscore. The underscore must not be at the end of the string. I do not want the username to include two consecutive underscores.

What I have tried:

[_a-zA-Z0-9][a-zA-Z0-9]+_?[a-zA-Z0-9]+

But the problem it fails for the username a_9

推荐答案



这篇关于用户名不能包含重复下划线或句点可以以下划线开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 07:27