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...
Status: RESOLVED DUPLICATE of bug 57672
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.8
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-20 14:49 UTC by Marek
Modified: 2022-03-13 18:51 UTC (History)
1 user (show)



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

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)
http://jmeter.apache.org/usermanual/regular_expressions.html
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
Comment 7 Felix Schumacher 2022-03-13 18:51:03 UTC
With next version of JMeter (5.5) we will have a switch (jmeter.regex.engine=java), that can be used to replace all occurrences of Oro with Java's regex implementation. Therefore I think, this bug is now a duplicate of 57672.

*** This bug has been marked as a duplicate of bug 57672 ***
Comment 8 The ASF infrastructure team 2022-09-24 20:37:52 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2990