如何使用正则表达式从 Jmeter 的响应头中获取值 [英] How to use regex to get value from response header in Jmeter
问题描述
我正在使用正则表达式从 JMeter 的响应头中获取值,我尝试获取查询 tt_unixtime
中的最后一个值,但失败了.
I am using regex to get value from response header in JMeter,
I try to get the last value in query tt_unixtime
and I failed.
有人可以建议如何使用正则表达式来获取最后一个值吗?
Can someone please advise how to user regex to get the last value?
我创建了一个名为 time44444444
的变量,我希望它从响应中获取值,问题是它什么都不存储.
I Created a variable called time44444444
and I want it to get the value from the response,
the problem is that it stored nothing.
推荐答案
您的 Regular Expression Extractor 用于获取匹配值的设置:
You have a few issues in your Regular Expression Extractor settings for getting the value matched:
应用于:响应头
正则表达式应该是 (\w+)
- 任何字母数字字符
Regular expression should be (\w+)
- any alphanumeric characters
模板应该是 $1$
- 第一组
Template should be $1$
- first group
匹配号应该是 1
- 找到第一个匹配
Match No. should be be 1
- find first match
用于从找到的匹配项中创建字符串的模板.这是一个带有特殊元素的任意字符串,用于引用正则表达式中的组.引用组的语法是:'$1$' 引用组 1
The template used to create a string from the matches found. This is an arbitrary string with special elements to refer to groups within the regular expression. The syntax to refer to a group is: '$1$' to refer to group 1
这篇关于如何使用正则表达式从 Jmeter 的响应头中获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!