两个特定字符串带有符号的;例如 "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"; }