Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个正则表达式
/^([a-zA-Z01-9]+ ?){0,20}$/
我有一套规则
我唯一的问题是将包括空格在内的字符串的长度设置为最大 20。
试试这个:^(?=[a-zA-Z\d\s]{0,20}$)([a-zA-Z01-9]+ ?)*$
^(?=[a-zA-Z\d\s]{0,20}$)([a-zA-Z01-9]+ ?)*$