Regular expression error in response to confirmation of response and emergency output of Jmeter expression

The response data in my test has the following line:

<head><title> My Title </title><meta charset 

I checked this regular expression in the built-in regular expression test in Jmeter and found the name.

 (?m)(?is)<title>\n\tMy Title\n</title> 

However, when I use it as a response statement, the statement always fails.

I tried all the settings in the Apply To section. "Text response" is selected for "Test response field." I selected "Contains" for "Pattern Matching Rules."

I have a very similar problem with the regular expression extractor - the selected expression passes in the tester, but does not work with the regular expression extractor.

I believe that this may have something to do with the multi-linear nature of the answer.

Any pointers?

+4
source share
3 answers

try using:

(?<=<title>\s*)(\S.+\S)(?=\s*</title>) to search for any name

(?<=<title>\s*)(My Title)(?=\s*</title>) to search for "My title"

+4
source

Try the following:

 Regular Expression: <title>(.+?)</title> Template: $1$ Match: 1 
+2
source

Try instead of xpath .

Use an expression like //title/text() along with XPath Extractor - to extract the title value - and an expression like //title[text()='My Title'] , along with XPath Statement .

In both cases, you must make sure that the Use Tidy parameter (tolerant parser) is CHECKED - because you are parsing the HTML response (not XML! ..).

0
source

All Articles