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-Z0-9]{2,20}$来允许以下规则: - 字母 az - 字母 AZ - 数字 0-9 - 输入长度必须至少为 2 个字符,最多为 20 个字符。
^[a-zA-Z0-9]{2,20}$
我还想只在以 s 结尾的单词末尾允许撇号。
谢谢,
^([a-zA-Z0-9]{2,20}|[a-zA-Z0-9]{2,18}'s)$
所以:无论是您的原始正则表达式,还是您的原始正则表达式(减少到最多 18 个字符,您可能还想更改最小值)以"'s".
"'s"