[英]Set limit to string in regular expression with white spaces
I have this regular expression 我有这个正则表达式
/^([a-zA-Z01-9]+ ?){0,20}$/
I have a set of rules 我有一套规则
The only problem that I have is to set the length of the string including the white space to 20 as maximum. 我唯一的问题是将包括空白在内的字符串的长度最大设置为20。
试试这个: ^(?=[a-zA-Z\\d\\s]{0,20}$)([a-zA-Z01-9]+ ?)*$
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.