var str = "系统发码:请求参数:【{\"OrderNo\":\"xxxx\",\"UserName\":\"xx\",\"UserTel\":\"xx\"}】,请求结果:【{\"IsSucceed\":false,\"Message\":\"该供应商没有对应的核销员,不允许发码\"}】< br > 系统发码:产品【我在测试】编号【1447】发码失败该供应商没有对应的核销员,不允许发码"; var regStr = "请求结果:【.*\"Message.*\"(?.*?)\"}】.*系统发码"; Regex reg = new Regex(regStr, RegexOptions.None); Match mc = reg.Match(str); var result = mc.Groups["message"].Value; Console.WriteLine(result); Console.ReadKey();
例子2:
var parIn = "data:image/jpeg;base64,aslkdhfilhweifgaj/skldgfg2ui346"; var regStr = ".*/(?.*?);.*"; Regex reg = new Regex(regStr, RegexOptions.None); Match mc = reg.Match(parIn); var result = mc.Groups["message"].Value; Console.WriteLine(result);
显示结果:
jpeg