Regular Expression failing in Response Assertion and Regular Expression Extractor Jmeter

jmeter, regex

Solution

try use:

`(?<=<title>\s*)(\S.+\S)(?=\s*</title>)` for find any title

`(?<=<title>\s*)(My Title)(?=\s*</title>)` for find 'My title'

Problem

The response data in my test has this line: ``` <head><title> My Title </title><meta charset ``` I checked this regex in the inbuilt regex tester in Jmeter and it found the title. ``` (?m)(?is)<title>\n\tMy Title\n</title> ``` However, when I use it as a response assertion, the assertion always fails. I have tried all settings in "Apply to" section. "Text Response" is selected for "Response Field to Test". I selected "Contains" for "Pattern Matching Rules". I have a very similar issue with a regular expression extractor as well - the selected expression passes in the tester, but fails with regular expression extractor. I believe it may have something to do with the multi-line nature of the response. Any pointers?

Original source

Related problems