【问题标题】:need regular expression in jmeter需要jmeter中的正则表达式
【发布时间】:2015-07-07 16:46:58
【问题描述】:
{"string":"{\"data\":[{\"id\":\"2c9180834e532f54014e6759d2ac004b\",\"unitName\":\"Actual11\",\"owner\":\"Nikolus\",\"description\":\"performance\",\"nofChairs\":0,\"nofBeds\":0,\"nofApptStartWithInHour\":0,\"nofApptDischargeWithInHour\":0,\"modifiedDateTime\":\"Jul 7, 2015 12:10:17

这是我的回应。此 id 将在下一个脚本中使用。请帮帮我

【问题讨论】:

标签: regex jmeter correlation


【解决方案1】:

试试这个,

\{"string":"\{\\"data\\":\[\{\\"id\\":\\"(\w+)\\",

仅当您的响应数据与您提供的相同时,这才有效。我认为有些\更像{\"data\":[{\"id\"。这应该是{"data":[{"id"。在这种情况下,

\{"string":"\{"data":\[\{"id":"(\w+)",

这应该足够了。下次先展示你的努力。

【讨论】:

    【解决方案2】:

    您最好使用任何 JSON 解码器吗?

    UPD

    /{"string":"{\\"data\\":\[{\\"id\\":\\"([a-f0-9]+)\\".*/
    

    我实际上不知道您的密钥的顺序和名称是否保持不变。

    【讨论】:

    • 这应该作为评论发布。
    • @Raptor 我提供了一个正则表达式来回答这个问题。
    猜你喜欢
    • 1970-01-01
    • 2016-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-17
    • 1970-01-01
    相关资源
    最近更新 更多