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.
我有一个表单,我正在使用 jQuery 验证插件进行验证,对于一个性别字段,我只想接受大写 F 或大写 M。我使用的正则表达式是,(F|M){1}但它同时传递了小写和大写 F 和 M。有吗我还能做些什么来防止小写字母被验证?
(F|M){1}
那个正则表达式对我来说看起来不错,默认情况下匹配应该区分大小写。
您是否意外地向正则表达式提供了/i修饰符,这会使其不区分大小写?
/i