0

I am looking for a way to replace a string using reg ex match in JScript .Net.

inputString = "this is my test string audienceId=123456 done here"

the value of the audienceId can be any 6 digit integer and is a random value.

I am using fiddler script which is based on JScript .Net.

So, I am looking for a way to replace the audienceId value in the inputString.

So far, i have tried the following and this will work only if the audienceId is a constant and does not change. Please help.

inputString = inputString.Replace('audienceId=123456', 'audienceId=')

1 Answer 1

1
inputString = inputString.replace(/audienceId=\d*/, 'audienceId=');

the \d matches a digit, the * repeats the digit x times (as many as it can find in a row)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.