51Testing软件测试论坛
标题:
LR用正则表达式获取
[打印本页]
作者:
qinruomo
时间:
2017-8-11 11:50
标题:
LR用正则表达式获取
LR用正则表达式获取
亲们,如何用正则表达式获取以下值?
这是服务器返回请求的部分,加粗部分需要正则表达式匹配关联
<input id="edit:foplList" type="hidden" name="edit:foplList"
value="[{"disabled":false,"label":"
58
","value":"001","escape":false,"noSelectionOption":false},
{"disabled":false,"label":"
同城
","value":"1","escape":false,"noSelectionOption":false},
{"disabled":false,"label":"
1
","value":"11","escape":false,"noSelectionOption":false},
{"disabled":false,"label":"
1
","value":"111","escape":false,"noSelectionOption":false},
{"disabled":false,"label":"
YSJ平台
","value":"123","escape":false,"noSelectionOption":false},
{"disabled":false,"label":"
大众点评网
","value":"2016","escape":false,"noSelectionOption":false},
{"disabled":false,"label":"
折800
","value":"901","escape":false,"noSelectionOption":false},
{"disabled":false,"label":"
京东平台
","value":"JDPT","escape":false,"noSelectionOption":false},
{"disabled":false,"label":"
苏宁易购
","value":"SNYG","escape":false,"noSelectionOption":false},
{"disabled":false,"label":"
淘宝平台
","value":"TBPT","escape":false,"noSelectionOption":false},
{"disabled":false,"label":"
天猫平台
","value":"TMPT","escape":false,"noSelectionOption":false},
{"disabled":false,"label":"
WORLD平台
","value":"WDPT","escape":false,"noSelectionOption":false},
{"disabled":false,"label":"
一号店
","value":"YHD","escape":false,"noSelectionOption":false},
{"disabled":false,"label":"
亚马逊
","value":"YMX","escape":false,"noSelectionOption":false}]" />
这是web_submit_data部分,加粗部分需要正则表达式匹配关联
/*"Name=edit:foplList", "Value=[{\"disabled\":false,\"label\":\"
58
\",\"value\":\"001\",\"escape\":false,\"noSelectionOption\":false},{\"disabled\":false,\"label\":\"
同城
\",\"value\":\"1\",\"escape\":false,\"noSelectionOption\":false},{\"disabled\":false,\"label\":\"
1
\",\"value\":\"11\",\"escape\":false,\"noSelectionOption\":false},{\"disabled\":false,\"label\":\"
1
\",\"value\":\"111\",\"escape\":false,\"noSelectionOption\":false},{\"disabled\":false,\"label\":\"
YSJ平台
\",\"value\":\"123\",\"escape\""
":false,\"noSelectionOption\":false},{\"disabled\":false,\"label\":\"
大众点评网
\",\"value\":\"2016\",\"escape\":false,\"noSelectionOption\":false},{\"disabled\":false,\"label\":\"
折800
\",\"value\":\"901\",\"escape\":false,\"noSelectionOption\":false},{\"disabled\":false,\"label\":\"
京东平台
\",\"value\":\"JDPT\",\"escape\":false,\"noSelectionOption\":false},{\"disabled\":false,\"label\":\"
苏宁易购\
",\"value\":\"SNYG\",\"escape\":false,\"noSelectionOption\":false},{\"disabled\":false,\"label\":\"""
淘宝平台
\",\"value\":\"TBPT\",\"escape\":false,\"noSelectionOption\":false},{\"disabled\":false,\"label\":\"
天猫平台
\",\"value\":\"TMPT\",\"escape\":false,\"noSelectionOption\":false},{\"disabled\":false,\"label\":\"
WORLD平台
\",\"value\":\"WDPT\",\"escape\":false,\"noSelectionOption\":false},{\"disabled\":false,\"label\":\"
一号店
\",\"value\":\"YHD\",\"escape\":false,\"noSelectionOption\":false},{\"disabled\":false,\"label\":\"
亚马逊
\",\"value\":\"YMX\",\"escape\":false,\"noSelectionOption\":false}]", ENDITEM,*/
作者:
不知道用啥
时间:
2017-8-11 15:22
一般我用过的取数组里的是这样取的"value":\["(.+?),你可以自己在看着匹配一下
作者:
qinruomo
时间:
2017-8-11 16:34
用左右边界取值,左边界,右边界都要正则表达式来写,问题是怎么写都匹配不出来
作者:
天之秦
时间:
2017-8-16 21:05
左边界是abel\":\",右边界是\",\"value。这样就可以把所有值存到一个数组里面。然后遍历数组,就可以取到所有值
作者:
qinruomo
时间:
2017-8-21 14:01
谢谢,此问题已解决
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2