Skip to main content
 首页 » 编程设计

c#之.NET正则表达式:内联大小写不起作用

2024年01月16日52softidea

我在这里做错了什么? .Net支持(?i :)构造用于大小写敏感度的内联修改...但是我无法使这一行正常工作。

Console.WriteLine(Regex.Match("ab(?i:z)", "abZ").Success); //Returns false,  
                                           //though it should return true?? 

请您参考如下方法:

第一个参数是输入,第二个参数是模式:

Regex.Match("abZ", "ab(?i:z)") 


MSDN: Regex.Match(string, string)