Bug 54176

Summary: Regular expression markers `\Q` `\E` doesn't work for "Response Assertion" and "RE Extractor"
Product: JMeter Reporter: Marek <marek.ruszczak>
Component: HTTPAssignee: JMeter issues mailing list <issues>
Status: REOPENED ---    
Severity: enhancement CC: p.mouawad
Priority: P2    
Version: 2.8   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Assertion doesnt work with \Q and \E
Screenshot showing that \Q \E works in "View Results Tree"

Description Marek 2012-11-20 14:49:22 UTC
Created attachment 29612 [details]
Assertion doesnt work with \Q and \E

Main use-case: escape spatial (for regular expressions) characters from content of variables (see stack overflow topic for details: http://stackoverflow.com/q/13472646/1387438 .

"\Q" and "\E" marks doesn't work for "Response Assertion" and "Regular Expression Extractor".
I'm inducing minimal test case showing the problem.

Run test plan included.
Go to "View Results Tree"
Select assertion (it is failed).
copy regular expression "google.time\Q()\E"
go to request select response
now test this regular expression and it will find match so it works in this response!

"\Q" and "\E" can surround anything (not only regular expression special characters) and problems always appears.
Comment 1 Milamber 2012-11-20 18:36:36 UTC
Bugzilla isn't a support forum.

Please use the JMeter user mailing.

Tips: JMeter uses Jakarta ORO for his RegExp engine (not Java RegExp)
Comment 2 Marek 2012-11-21 08:50:43 UTC
Ok. I missed this in documentation, but  I've found there:

    20.6 Testing Regular Expressions

        Since JMeter 2.4, the listener View Results Tree include a RegExp Tester
        to test regular expressions directly on sampler response data.

As I wrote: this regular expression (containing \Q\E) works in "View Results Tree", so there is definitely some incoherency how regular expressions works in JMeter and that is why I threated this as a bug.
Comment 3 Sebb 2012-11-21 10:28:55 UTC
The Regexp Tester uses the same Regex engine, i.e. Jakarta ORO.

I just tried using JMeter 2.8, and \Q and \E do *not* work.
Comment 4 Marek 2012-11-21 11:07:51 UTC
Created attachment 29617 [details]
Screenshot showing that \Q \E works in "View Results Tree"

Some magic happens or we are talking about different things, it works in my "View Results Tree", see screenshot.
Comment 5 Sebb 2012-11-21 13:42:06 UTC
I was using the Regexp Tester.

You were using the Search faciliry, which uses the Java regex engine.
Comment 6 Philippe Mouawad 2012-11-21 22:15:32 UTC
I find this a little disturbing for users.
Shouldn't we either:
- Replace java regexp engine from search feature by oro
- Or replace oro by java engine regexp but this is an issue for existing Test Plans