pm-finamis opened a new issue, #6066:
URL: https://github.com/apache/jmeter/issues/6066

   ### Use case
   
   UDV now only supports replacing the whole value match for ${variableName}.
   1) Sometimes the parameter values are not unique enough
   E.g. in request body
   TENANT_ID|1|STYLE_ID|1
   a value match "1" is not unique enough to identify tenantId variable and 2 
replacements would be done.
   TENANT_ID|${tenantId}|STYLE_ID|${tenantId}
   2) or are not needed at all to place a new variable into test.
   E.g. in request body
   TENANT_ID|1|STYLE_ID|1
   match value of "1" is not needed and better way would be looking for 
parameter name "TENANT_ID".
   
   ### Possible solution
   
   Support regex group matching and replacing
   E.g. in request body
   TENANT_ID|1|STYLE_ID|1
   for pattern: (?<prefix>\bTENANT_ID\|)(?<value>[0-9]+?)(?<suffix>\|\b)
   groups prefix and suffix would be copied without change, value group would 
be replaced by the variable ${tenantId}. 
   result would be
   TENANT_ID|${tenantId}|STYLE_ID|1
   Pattern is able to identify variables without even knowing the value of the 
parameter in request body, it matches any number.
   Although a static value could be used 
(?<prefix>\bTENANT_ID\|)(?<value>123)(?<suffix>\|\b) too.
   
   Please see the attached patch 
   
[ReplaceFunctionsWithStrings.patch](https://github.com/apache/jmeter/files/12396493/ReplaceFunctionsWithStrings.patch)
   Only java regex are implemented, not oro.
   Method transformValueWithJavaRegex is made protected to be used in unit 
tests.
   UDV values that contain regex for group replace would be identified by '*' 
at their start for backward compatibility.
   
   
![image](https://github.com/apache/jmeter/assets/21262290/553792a3-69ea-4575-877f-6b551da6d6d9)
   
   
   ### Possible workarounds
   
   _No response_
   
   ### JMeter Version
   
   5.6.2
   
   ### Java Version
   
   17
   
   ### OS Version
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@jmeter.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to