LR RegExp troubles.

Hi guys. I've got a trouble with thise code, which I use  to parse answer for async request:

lr_save_param_regexp (
        aResponseBodyStr,
        aResponseBodyLen,
        "RegExp/IC=index(. ?)VRId-.", 
        "Ordinal=ALL",
        "ResultParam=Poll_Param",
         LAST );

The responce contains something like this example:

`7`1``0`br`0`ar`-1`size`6`index`2`cr`0`OP`iw`bc`S_BC3`1`0`FieldValues`0`ValueArray`<here some usefull payload, which parsing is the next step>*6*VRId-2

 

What can I do, to parse this (without creations my own parsing functions)?

 

 

  • Hello, 

    For this scenario there is no function. 

    You will have to perform your own function, our recommendation is in C language.

    and then use the function for your recording. 

    Regards,

  • 1. your function call matches with your given response. (Note that in the documentation of 12.55 this functions is incorrect documented).

    2. you can use this function according documentation in your 'Response Callback' function.

    So if you do both things, what is the issue you have?

  • I've got LR 12.02. And I use it inside BC (which I set as ResponseCB). As result I have no parsed results. Seems that It's problem with last symbol in regexp (the dot) and my regexp too complex for LR. Because this regexp works fine:

    index(. ?)VRId-

     

     

    It there is no any move ways, I'll use own C-function as   suggest.

  • I cannot test with LR 12.02. But I verified your code with a sample that I put into an empty script and enabled Parameter Logging:

    vuser_init()
    {
    	char *p = "`7`1``0`br`0`ar`-1`size`6`index`2`cr`0`OP`iw`bc`S_BC3`1`0`FieldValues`0`ValueArray`<here some usefull payload, which parsing is the next step>*6*VRId-2";
    	
    	lr_save_param_regexp (
            p, strlen(p),
            "RegExp/IC=index(. ?)VRId-.", 
            "Ordinal=ALL", "ResultParam=Poll_Param", LAST );
    	return 0;
    }

    I think that the 'dot' will not be the issue, but it might be bug. Do you always have a digid after 'VRId-'? Then you can replace the dot with \d to match with any digit. So your regexp argument will be:

    "RegExp/IC=index(. ?)VRId-\\d"

     Note the  double \ to make it work in a C-string.