Ad Widget

Collapse

Regex in web scenario step containing double quotes and not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jraph
    Junior Member
    • Jun 2020
    • 1

    #1

    Regex in web scenario step containing double quotes and not working

    Hi,

    I am trying to create a full web scenario for an application monitoring and I managed to get the first steps working.
    My problem is the application uses dynamic urls, so I have to extract informations from response, and this step fails.

    I recreated the steps manually with Curl and it seems to work -> the informations are present in the response header / body.
    I have two variables to get from answer:


    FIRST:
    I have the following answer from login page :
    <input type="hidden" name="ES" value="17482364115912607608142113320734">

    I tried the following :
    Code:
    regex:name="myes_regex" content=" name="ES" value="([\S]*)">$"
    regex:name="myes_regex" content=" name="ES" value="([0-9]*)">$"
    But this generates error : cannot extract the value of "{ES}" from response

    The failure may be related to the fact that there are double quotes in the pattern I have to detect, and the regex definition requires double quotes.
    As there are double quotes in the pattern I tried to escape them in the regex (and also escape the backslash) :

    Code:
    regex:name="myes_regex" content=" name=\"ES\" value=\"([\\S]*)\">$" cannot extract the value of "{ES}" from response
    So escaping the double quotes does not work either.

    I also tried this :
    Code:
    regex:name="myes_regex" content=" name=.ES. value=.([0-9]*).>$"
    SECOND:
    I have to get the next url which is present in the response headers :
    Code:
    < Location: loginRedirect?X=60797819&US=16708796051591260797819742781218&ES=4701825894969022464
    I have to extract starting at locationRedirect.......

    So I have to point to
    Code:
    [URL="https://website/loginRedirect?X=60797819&US=1670879605159126079781"]https://website/loginRedirect?X=6079605159126079781[/URL]9742781218&ES=4701825894969022464
    The step in the web scenario is configured to look into headers and body (which I forgot at first)

    In the variable I have declared the regex :
    Code:
    {MYAMLURL} => regex:name="myurl_regex" content="^Location: (loginRedirect[\S]*)$"
    I saw we may have to double the antislash so I tried with \\S but still have error.
    Code:
    {MYAMLURL} => regex:name="myurl_regex" content="^Location: (loginRedirect[\\S]*)$"
    But these definitions do not work as I have the message "cannot extract the value of {MYAMLURL} from response"

    Thanks for helping

    Raphael
    Last edited by jraph; 05-06-2020, 16:53.
Working...