正则表达式截取两个特定字符串之间的字符串

两个特定字符串带有符号的;例如

"PROMOTEDTYPE":"260","MEMBERID":"24912496","SHOPTYPE":"2","EXLEVEL":"15""PROMOTEDTYPE":"260","MEMBERID":"78912496","SHOPTYPE":"2","EXLEVEL":"15""PROMOTEDTYPE":"260","EXMEMBERID":"28912496","SHOPTYPE":"2","EXLEVEL":"15""PROMOTEDTYPE":"260","MEMBERID":"74122906","SHOPTYPE":"2","EXLEVEL":"15"。

这段字符串,需要提取 "MEMBERID":"24912496","SHOPTYPE" 中间的数字 24912496

这样的 用正在表达式 怎么处理 特定字符串 带有符号的? 

 

    string test = "\"PROMOTEDTYPE\":\"260\",\"MEMBERID\":\"24912496\",\"SHOPTYPE\":\"2\",\"EXLEVEL\":\"15\",\"PROMOTEDTYPE\":\"260\",\"MEMBERID\":\"78912496\",\"SHOPTYPE\":\"2\",\"EXLEVEL\":\"15\",\"PROMOTEDTYPE\":\"260\",\"EXMEMBERID\":\"28912496\",\"SHOPTYPE\":\"2\",\"EXLEVEL\":\"15\",\"PROMOTEDTYPE\":\"260\",\"MEMBERID\":\"74122906\",\"SHOPTYPE\":\"2\",\"EXLEVEL\":\"15\"。";
            Regex reg = new Regex("(?i)(?<=MEMBERID\":\")[^\"]*(?=\")");
            MatchCollection mc = reg.Matches(test);
            foreach (Match m in mc)
            {
                richTextBox2.Text += m.Value + "\n";
            }

 

posted on 2012-05-18 11:05  HOT SUMMER  阅读(38160)  评论(0编辑  收藏  举报

导航