我必须在正则表达式提取器中使用什么正则表达式?

时间:2014-09-23 06:18:29

标签: regex jmeter

我在JMeter中有以下回应:

{"的 ID":" 140 "" RSD":空," COL&#34 ;: "绿色"," cc":" B5307F"," pn":" KENWAY轮胎更新2014",&# 34; loc":" ABD-LR / L3 / L3"," isf":" 1 ",&# 34;的 ISL":" 0 "" TQ":" 15"" PI" :空,"的 ST":" 1 "" DSID":" 15"&#34 ; CID":" 2120"" SPL":空," WID":" WI / 3ivdfzhg"" INV":空," PDID":" 1103""二":" 0"" PL&#34 ;:" 0"}

当isf = 1,isl = 0且st = 1时,我需要提取id的值。我必须在正则表达式提取器中使用什么正则表达式?

提前致谢。

2 个答案:

答案 0 :(得分:0)

(?=.*?isf":"1)(?=.*?isl":"0)(?=.*?st":"1)id":"(\d+)

试试这个。只需抓住第一组。参见演示。

http://regex101.com/r/lS5tT3/5

答案 1 :(得分:0)

给定的文本格式是

{"id":"140","rsd":null,"col":"green","cc":"B5307F","pn":"KENWAY TYRES RENEWAL 2014","loc":"ABD - LR / L3 / L3","isf":"1","isl":"0","tq":"15","pi":null,"st":"1","dsid":"15","cid":"2120","spl":null,"wid":"WI/3ivdfzhg","inv":null,"pdid":"1103","di":"0","pl":"0"}

我们需要创建正则表达式格式以使用以下条件提取id值

"isf":"1" and "isl":"0" and "st":"1"

正则表达式格式化以在条件值为真时获取id值

正则表达式格式

"id":"(.+)".+"isf":"1","isl":"0",.+"st":"1"