解决方案 »

  1.   

    {\"ProjectId\":6,\"WellName\\"ProjectId\":.*?,
    正则里 \"被转义成" 而你的字符串是\" 所以你需要再进行转义
    \\\"ProjectId\\\":(.*?),
    并且将你要取的值进行用括号提取
      

  2.   

    怎么看着,向是解析JSON格式数据啊……
      

  3.   

    fun()
    {
       string scan = "[{\"ProjectId\":6,\"WellName\":\"sample string 2\"]";
                string pattern = "\"ProjectId\":[0-9]*";
                MatchCollection matches = Regex.Matches(scan, pattern, RegexOptions.IgnorePatternWhitespace);
                foreach (Match match in matches)
                {
                    Console.WriteLine(match.ToString().Replace("\"",""));
                }
    }
    结果:ProjectId:6不知道是不是你想要的
      

  4.   


    string s = "“[{\"ProjectId\":6,\"WellName\":\"sample string 2\",...”";
                Match m = Regex.Match(s, "ProjectId\\\":[0-9]?");
                string a = m.Groups[0].Value.Replace("\":"," ");