名字的正则表达式 [英] regular expression for first name
本文介绍了名字的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个满足条件的名字的正则表达式
1.只允许字符
2.只有第一个字母需要是大写字母后跟小写字母
I want a regular expression for first name that satisfies the conditions
1.Only characters allowed
2. only first letter need to be capital letter followed by small letters
推荐答案
您好,
试试这个
Hello ,
Try This
^[A-Z][a-z]{3,19}
和解释是
and Explanation is
^ assert position at start of the string
[A-Z] match a single character present in the list below
A-Z a single character in the range between A and Z (case sensitive)
[a-z]{3,19} match a single character present in the list below
Quantifier: {3,19} Between 3 and 19 times, as many times as possible, giving back as needed [greedy]
a-z a single character in the range between a and z (case sensitive)
在 string
和现场演示 试试这个
这篇关于名字的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文