Extracting value from HTML Responce using Regular expression in JMETER?

后端 未结 8 799
长发绾君心
长发绾君心 2020-12-11 21:09

I am getting response from Jmeter like this:

相关标签:
8条回答
  • 2020-12-11 22:06

    Actually the best awnser is from Ibu in the comment:

    value=\"(\d+)\" and: value="([^"]+?)" will workfine too

    So in jemter it will look like this:

    reference name: value

    Regex: (\s value=\"(\d+)\")

    Regex: (\s value="([^"]+?)")

    template : $2$

    match no.:1

    If you want only the value that have the reference name queueItemId you might want to modify the reg ex to this.

    So from jmeter reg ex extractor you got :

    reference name: queueItemId

    Regex: (name="queueItemId" \s value="([^"]+?)")

    Regex: (name="queueItemId" \s value=\"(\d+)\")

    template : $2$

    match no.:1

    You should check the regex with jakarta oro because it's the reg ex engine that jmeter use.

    Check out jakarta ORO here : http://jakarta.apache.org/oro/demo.html

    ORO is a reg ex tool that behave almost exactly like jmeter.

    Most of the time the the standart reg ex tool will work but it has happened to me sometime that the reg ex was fine in my tool but was not working in jmeter.

    I later found out the ORO tool and was able to make it work in oro (and jmeter)

    Another note: I think jmeter ignore space in your reg ex you have to add /s when you want to compare a space.

    0 讨论(0)
  • 2020-12-11 22:06

    The following regular expression will match the parameter and its value:

    \bencounterId=(\d*)
    

    The parentheses enable extraction of the value. Note the word boundary \b which makes sure a parameter ending with encounterId such as fooencounterId is not matched.

    0 讨论(0)
提交回复
热议问题