如何使用JMeter中的REGEX提取器从变量中获取部分值?

时间:2021-06-26 23:10:27

I have a request in JMeter and I want to get some values from the body that it returns to me.

我在JMeter有一个请求,我想从它返回给我的身体得到一些值。

Here is a part of the HTML body return:

以下是HTML正文返回的一部分:

<input type="hidden" name="__Code" id="__Code" value="53e9d02a-727s-4b13-9w6be-bsfq44a8221251" />
...
<input name="$CpfCnpj" type="text" value="26341646784" maxlength="14" id="CpfCnpj" autocomplete="Off" style="width:200px;" />
...
<a href='javascript:ExibirFilaItemPedido(5101709, false, false);'>198062084</a>

I want to get the 5101709 value.

我想要得到5101709的值。

I'm trying to get this value with REGEX Extractor

我试着用REGEX提取器来获取这个值。

如何使用JMeter中的REGEX提取器从变量中获取部分值?

But the value that I'm getting is "(5101709".

但我得到的值是(5101709)

If I put the REGEX "[0-9]{7,}" the value that I get is the "8221251" and I don't want this one. I can't put the number 5101709 fixed, because this numbers can change. Someone knows how can I get only the numbers after the "("?

如果我输入REGEX "[0-9]{7,}"我得到的值是"8221251"我不想要这个。我不能把数字5101709固定下来,因为这个数字可以改变。有人知道我怎么能只得到“(”后面的数字?

1 个解决方案

#1


2  

You may use

你可以用

[(]([0-9]{7,})

and set the template to $1$.

并将模板设置为$1。

The [(]([0-9]{7,}) pattern matches a (, then matches and captures into Group 1 (that you access with $1$) seven or more digits.

[(]([0-9]{7,})模式匹配a(,然后匹配并捕获到组1(您使用$1访问的)7个或更多的数字。

#1


2  

You may use

你可以用

[(]([0-9]{7,})

and set the template to $1$.

并将模板设置为$1。

The [(]([0-9]{7,}) pattern matches a (, then matches and captures into Group 1 (that you access with $1$) seven or more digits.

[(]([0-9]{7,})模式匹配a(,然后匹配并捕获到组1(您使用$1访问的)7个或更多的数字。