Bug 55328

Summary: __escapeOroRegexpChars trims spaces
Product: JMeter - Now in Github Reporter: rom4nevg
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: minor CC: p.mouawad
Priority: P2    
Version: 2.9   
Target Milestone: ---   
Hardware: All   
OS: All   

Description rom4nevg 2013-07-30 09:59:44 UTC
__escapeOroRegexpChars function, accroding to my observations during the work with jmeter and also according to jmeter's source code, trims leading and trailing whitespaces, which was a total surprise for me.

For example, if I use ${__escapeOroRegexpChars(${SOME_VARIABLE})} in a response assertion (where SOME_VARIABLE could contain _important_ leading/trailing whitespaces), this behaviour results in inexact matches, or a failed match, if I prepend or append this assertion with some text, e.g. some_text${__escapeOroRegexpChars(${SOME_VARIABLE})}.

If this behaviour is correct and is not a subject to changes, at least it could've been mentioned in the documentation (in fact, in this case I am more dissatisfied with the fact that the documentation misses this point, rather than with the behaviour itself; trimming is mentioned in the header of the "Functions reference" section http://jmeter.apache.org/usermanual/functions.html, but it regards variable names only).
Comment 1 Sebb 2013-07-30 16:06:43 UTC
Not sure why it was coded like this, but the function does trim both the value and the variable name (if provided).

I suspect only the variable name should be trimmed.
Comment 2 Philippe Mouawad 2013-07-30 16:17:07 UTC
I don't remember why I made the trim on value, anyway I think it should be fixed with a mention in changes.html.
Comment 3 Philippe Mouawad 2013-07-30 19:42:57 UTC
Date: Tue Jul 30 19:42:13 2013
New Revision: 1508589

URL: http://svn.apache.org/r1508589
Log:
Bug 55328 - __escapeOroRegexpChars trims spaces
Bugzilla Id: 55328

Modified:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/EscapeOroRegexpChars.java
    jmeter/trunk/xdocs/changes.xml
Comment 4 The ASF infrastructure team 2022-09-24 20:37:54 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3175