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.
我想在 C# 中只检查英文字母或空字符串。我尝试编写正则表达式,但它不起作用:
@"[^$|a-zA-Z]"
任何建议都会有所帮助:)
"^[a-zA-Z]*$"将匹配 0 个或多个小写或大写字母。请注意,这与数字或空格不匹配。
"^[a-zA-Z]*$"