Closed asfimport closed 20 years ago
Sebb (migrated from Bugzilla): What options are you using on the Response Assertion - are you using "matches" or "contains"?
Perhaps you could right-click and save the RA test element, and post it as an attachment here.
What is the exact text you are matching against? [Please post as an attachment]
There's some further information on Regular Expressions in the JMeter FAQ.
Petri Suutarinen (migrated from Bugzilla): Created attachment response.html: Response HTML that response assertion can't parse correctly
Sebb (migrated from Bugzilla): That won't MATCH against
<html>.*</html>
as there is text before the first <html> tag.
However, it should pass a CONTAINS Response Assertion.
If the actual value in the Response Assertion is
"<html>.*</html>"
i.e. with the quotes, neither MATCH nor CONTAINS will succeed.
Petri Suutarinen (migrated from Bugzilla): I'm using CONTAINS mode. And the string I'm trying to check is really
<html>.*</html>
not with quotes.
Sebb (migrated from Bugzilla): Sounds as though it should work...
Tried a quick test, and it looks like the response is being treated as multiple lines, and so "." does not match new-line. Sorry, should have realised this earlier...
Try adding (?s) to the start of the line.
Petri Suutarinen (migrated from Bugzilla): I debugged this problem more deeply and it looks like Perl5Compiler problem. If you look at the JMeter1.9.1 code (line 305). I added there MULTILINE_MASK like this (because there was not one).
Pattern pattern =
patternCache.getPattern(
stringPattern,
Perl5Compiler.MULTILINE_MASK|Perl5Compiler.READ_ONLY_MASK);
Then I compiled and tried it with a following rexexp: <html>(.|\n)</html>
The result is that contains(..)-function prints java.lang.StackoverflowError. I'm quite poor with regular expressions but I don't think that my example causes infinite loop. I also find discussion about this same problem. Here is link to it.
http://www.mail-archive.com/oro-user@jakarta.apache.org/msg00356.html
Btw. What did you mean with adding (?s) to the start of the line?
Sebb (migrated from Bugzilla): <html>(.|\n)</html> won't work - you probably meant <html>(.|\n)*</html>
Alternation - i.e. | - is very expensive as the matcher has to be able to backtrack if one of the alternatives does not work.
<html>[.\n]*</html> should work
(?s) means treat as single line, i.e. "." matches "\n"
Sebb (migrated from Bugzilla): I've updated the component documentation to explain how the matching works, so closing this call
Petri Suutarinen (Bug 26885): Following string does not work when added to response assertin component.
"<html>.*</html>"
This is copied from the documentation so regular expressions does not work on response assertion component or the documentation is not up to date. I'm using JRE1.4.2_3.
Severity: normal OS: Linux