Home > Enterprise >  I want to ignore "\" in the dynamic value
I want to ignore "\" in the dynamic value

Time:10-08

When i am launching the web application it is generating a state token which is dynamic value looks like this"State_token_g0=stateToken = '00aF\x2D5HSbtfsCjJbYUAayevCC5uvH9Qg5aMGSUvKEM';" and it is getting failed and throwing an error as"{"errorCode":"E0000003","errorSummary":"The request body was not well-formed.","errorLink":"E0000003","errorId":"oaewNC2ocVjS6m_EpiszsjV7Q","errorCauses":[]}". If the dynamic value generated without "" it is getting executed. it is not possible to delete \ from the library as well. Tried multiple regex ^[a-zA-Z0-9] $, [^"] ?, \d ?,\w ?, {"stateToken":([^"] ?),^[A-Z0-9a-z\~!@#$%^&()_ |,./<>?] $,[A-Z0-9a-z\], ^[A-Z0-9a-z\] $

CodePudding user response:

replace(/\\/g, ''); 

will replace backslashes, could you add this to your regex?

let string = "00aF\x2D5HSbtfsCjJbYUAayevCC5uvH9Qg5aMGSUvKEM";
var minusbackslash = string.replace(/\\/g, '');

//show result in result div
document.getElementById("result").innerText = minusbackslash;
<div id="result"></div>

CodePudding user response:

You can remove backslashes by adding a enter image description here

In the above example vars stands for JMeterVariables class instance, see the JavaDoc for full description of all functions and fields and Top 8 JMeter Java Classes You Should Be Using with Groovy article for more details on this and other JMeter API shorthands available for the JSR223 Test Elements

  • Related