学习正式表达式关联

上一篇 / 下一篇  2012-08-20 15:04:04 / 个人分类:LR学习日记

  首先确认LR11中带有web_reg_save_param_regexp("ParamName=<output parameter name>", "RegExp=regular_expression",[<List of Attributes>,] [<SEARCH FILTERS>,] LAST ); 这个函数。(PS:如果没有需要安装补丁,patch 3);
  下面是从loadrunner进阶指南lr11上学习到的例子,已运行过,能正常使用:
     Action()
{
    int replyid,i;  
    web_reg_save_param_regexp(
          "ParamName=noreplytopic",
          "RegExp=em>0</em>.*\r\n.*tid=(.*)&page.*title",    
          //.*表示替换任意内容;\r\n表示回车符和换行符
          "Ordinal=ALL",
          SEARCH_FILTERS,
          LAST);

    web_url("forum","URL=http://192.168.1.10:88/phpwind85/thread.php?fid=2",LAST);
    replyid=lr_paramarr_len("noreplytopic");      //取tid长度
 
    for(i=1;i<=replyid;i++)
      {
        lr_save_string(lr_paramarr_idx("noreplytopic",i),"temp");  
        //将tid数组元素存为字符串
        web_url("topic","URL=http://192.168.1.10:88/phpwind85/read.php?tid={temp}",LAST);
      }
 return 0;
}

TAG: 正值表达式

 

评分:0

我来说两句

Open Toolbar