Jmeter中动态字符串的正则表达式是什么?

时间:2022-03-04 13:23:25

This is getting generated in a request output in Jmeter and I need to capture the dynamic value.

这是在Jmeter的请求输出中生成的,我需要捕获动态值。

<update id="javax.faces.ViewState"><![CDATA[-8480553014738537212:-8925834053543623028]]></update> 

the - (hyphen) symbol coming in the output is also dynamic.

输出中的 - (连字符)符号也是动态的。

I have tried handling this using

我试过用这个来处理

<update id="javax.faces.ViewState"><![CDATA[(.+?)]]></update> 

But this is not helping. Please suggest.

但这没有帮助。请建议。

1 个解决方案

#1


2  

The correct way to grab the data is by using the XPath Extractor with the following XPath:

获取数据的正确方法是使用XPath Extractor和以下XPath:

//update[@id='javax.faces.ViewState']/text()

It gets the update tags that have id attribute with the javax.faces.ViewState value and extracts the text from these nodes.

它获取具有javax.faces.ViewState值的id属性的更新标记,并从这些节点中提取文本。

Your regex is not correct because the [ (and literal dots) must be escaped in the regular expressions, and can be fixed as <update\s+id="javax\.faces\.ViewState"><!\[CDATA\[([^\]<]+)]]></update>. See the regex demo.

你的正则表达式是不正确的,因为[(和字面点)必须在正则表达式中转义,并且可以修复为 。请参阅正则表达式演示。

#1


2  

The correct way to grab the data is by using the XPath Extractor with the following XPath:

获取数据的正确方法是使用XPath Extractor和以下XPath:

//update[@id='javax.faces.ViewState']/text()

It gets the update tags that have id attribute with the javax.faces.ViewState value and extracts the text from these nodes.

它获取具有javax.faces.ViewState值的id属性的更新标记,并从这些节点中提取文本。

Your regex is not correct because the [ (and literal dots) must be escaped in the regular expressions, and can be fixed as <update\s+id="javax\.faces\.ViewState"><!\[CDATA\[([^\]<]+)]]></update>. See the regex demo.

你的正则表达式是不正确的,因为[(和字面点)必须在正则表达式中转义,并且可以修复为 。请参阅正则表达式演示。