关于c#中的正则表达式

时间:2013-12-09 12:11:10

标签: c# regex

以下reg exp,

的含义是什么?
?i:msie (?:7|8|9)\\.

用于下一个陈述:

Regex.IsMatch(context.Request.UserAgent, "(?i:msie (?:7|8|9)\\.)")

1 个答案:

答案 0 :(得分:0)

这是c#中正则表达式的完整解释:

(?i:msie (?:7|8|9)\\.)

Options: Case sensitive; Exact spacing; Dot doesn't match line breaks; ^$ match at line breaks; Parentheses capture

Match the regex below with these options «(?i:msie (?:7|8|9)\\.)»
   Case insensitive «i»
   Match the character string “msie ” literally (case insensitive) «msie »
   Match the regular expression below «(?:7|8|9)»
      Match this alternative (attempting the next alternative only if this one fails) «7»
         Match the character “7” literally «7»
      Or match this alternative (attempting the next alternative only if this one fails) «8»
         Match the character “8” literally «8»
      Or match this alternative (the entire group fails if this one fails to match) «9»
         Match the character “9” literally «9»
  Match the backslash character «\\»
  Match any single character that is NOT a line break character (line feed) «.»