问题描述
鉴于这种常规的前pression:^ [0-9] * \ S *(磅|公斤|公斤)$
如何使它不区分大小写?我想利用这个在.NET正EX pression验证,所以我需要在模式中指定不区分大小写。
Given this regular expression: "^[0-9]*\s*(lbs|kg|kgs)$"
how do I make it case insensitive? I am trying to use this in a .net regular expression validator, so I need to specify case insensitivity in the pattern.
我不能使用RegexOptions编程,因为我指定的正规EX pression在RegularEx pressionValidator
推荐答案
我发现了。
区分大小写: ^ [0-9] \ S(磅|公斤|公斤)$
不区分大小写:(I:^ [0-9] \ S(磅|公斤|公斤)$)
我认为,这是特定于.NET实现定期EX pressions。所以,如果你用这个在RegularEx pressionValidator你必须关闭客户端验证,因为JavaScript的正则表达式解析器将无法识别?我
标记。
I believe that this is specific to the .NET implementation of regular expressions. So if you use this in the RegularExpressionValidator you have to turn off client side validation because the javascript regex parser will not recognize the ?i
token.
这篇关于定期EX pression不区分大小写的ASP.NET RegularEx pressionValidator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!