There will be instances where we will have to replace a part of the correlation string and pass it on to subsequent request in Jmeter. This can be achieved in 2 methods.
Actual Correlation Output: C_SID = Hello-World
Expected Correlation Output: C_SID_R = Hello-World
Method 1: Using the existing "__strReplace" function from "Custom JMeter Functions" Plugin.
Install the "Custom JMeter Functions" Plugin from plugins manager and restart the Jmeter.
Syntax: ${__strReplace(InputString,To Be Replaced,To Replace,OutputString)
Code : ${__strReplace(${C_SID},-,-,C_SID_R)
Method 2: Using a Beanshell sampler
Code:
String a = vars.get("C_SID");
String b = a.replaceAll("-", "-");
vars.put("C_SID_R",b);