如何使用正则表达式关联百度AJAX搜索提示
PYL9?3Lb*i_0
web_reg_save_param_regexp( m rBni9k*R0 "ParamName=aaa", [p7_hP?0 "RegExp=[,[]"(.*?)"", O"i^o2H$i0 "Ordinal=ALL", -z4Xu0H#J?0 SEARCH_FILTERS, X1^!hQ+z0 LAST);51Testing软件测试网-|7r,e;C,F$kb ~
Z7K+f6WE9a0 web_url("test","URL=http://suggestion.baidu.com/su?wd=loadrunner&p=3&cb=window.bdsug.sug&sid=2901_2777_1420_2785_2580_1788_2250_2543_2701&t=1374485314413",LAST);
最近有个朋友和我讨论这个问题,说纠结很久了,就是怎么对百度搜索的Json返回做正则表达式关联,我试了一下确实也没找到好办法,直到和土匪讨论了一下,给出了结果 百度搜索的关键字提示是这样的JSON结构 window.bdsug.sug({q:"abd",p:false,s:["奥比岛","abdukerim abliz 2013","abd.exe","abdomen","abdc","奥比岛小游戏","abdulla abdurehim","abduction","abdominal","阿宝的歌曲"]}); 我们需要取到的是[]中的每个“”双引号的内容,其实我还是没想明白为啥可以这样取,但是需要编写的正则表达式为 [,[]"(.*?)" 写成LR代码是: web_reg_save_param_regexp( "ParamName=aaa", "RegExp=[,[]"(.*?)"", "Ordinal=ALL", SEARCH_FILTERS, LAST); web_url("test","URL=http://suggestion.baidu.com/su?wd=loadrunner&p=3&cb=window.bdsug.sug&sid=2901_2777_1420_2785_2580_1788_2250_2543_2701&t=1374485314413",LAST);