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.
我想检查一个 Vb.net 字符串是否包含至少 3 个非空白字符,其中至少有一个非数字字符。
任何人都可以帮助为它创建正则表达式吗?
ab c 有效 2c 有效 abc 有效 1 无效 123 无效
ab c 有效
2c 有效
abc 有效
1 无效
123 无效
我试过这个
^[A-Z]{3}$
但它不工作
您可以使用正向预读来确保至少有一个字符不是数字(在此示例中为 AZ),然后需要三个非空白字符 ( \S) 由零个或多个空白字符 ( \s)。
\S
\s
(?=.*[A-Z])\S\s*\S\s*\S