代码之家  ›  专栏  ›  技术社区  ›  Bastian

如何在Jmeter响应体中使用Regex

  •  1
  • Bastian  · 技术社区  · 6 年前

    <html><head></head><link rel='icon' href='data:;base64,iVBORw0KGgo='><body>Sorry, this is temporarily unavailable. (103)</body></html>
    

    我想保存代码,意思是103。

    适用于:主样本和子样本

    问题是我没有成功地找到要在regula表达式字段中放入什么。

    enter image description here

    enter image description here

    1 回复  |  直到 6 年前
        1
  •  1
  •   Wiktor Stribiżew    6 年前

    你可以用

    Sorry,[^<>]*\(([0-9]+)\)
    

    regex demo

    • Sorry, -文字子串
    • [^<>]* -任何0+字符 < >
    • \( ( 烧焦
    • ([0-9]+)
    • \) -a ) 烧焦。

    请注意,您需要设置的模板是 $1$ (您甚至可以在屏幕截图中看到该符号要求)。