Bug 54176 - Regular expression markers `\Q` `\E` doesn't work for "Response Assertion" and "RE Extractor"
Summary: Regular expression markers `\Q` `\E` doesn't work for "Response Assertion" an...
Alias: None
Product: JMeter
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.8
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
Depends on:
Reported: 2012-11-20 14:49 UTC by Marek
Modified: 2012-11-21 22:16 UTC (History)
1 user (show)

Assertion doesnt work with \Q and \E (6.87 KB, application/octet-stream)
2012-11-20 14:49 UTC, Marek
Screenshot showing that \Q \E works in "View Results Tree" (125.67 KB, image/png)
2012-11-21 11:07 UTC, Marek

Note You need to log in before you can comment on or make changes to this bug.
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