Vis*_*u Y 1 javascript regex validation
我需要一个帮助框架正则表达式来验证Javascript中的字符串格式,
字符串的总长度应在3到30个字符之间.第一个字符必须严格按字母表.后续字符可以是字母或点或空格.请帮忙.
以下内容适合您.
var re = /^[a-z][a-z. ]{2,29}$/i
Run Code Online (Sandbox Code Playgroud)
正则表达式:
^ # the beginning of the string
[a-z] # any character of: 'a' to 'z'
[a-z. ]{2,29} # any character of: 'a' to 'z', '.', ' ' (between 2 and 29 times)
$ # before an optional \n, and the end of the string
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
57 次 |
最近记录: |