I am trying to perform a search and replace in a string using javascript. An example of the string looks like this: Parameter 1 = xxx where xxx are some characters that I want to replace
The RegEx needs to find everything after "Parameter 1 = " until the end of the line, which is xxx. The javascript then needs to replace xxx it with yyy, where yyy are some other characters. For example, Parameter 1 = 42 => Parameter 1 = 11
I found the regex for this on this forum (What Regex would capture everything from ' mark to the end of a line?). Modifying it for my case would be:
(?<=Parameter 1 = ).*$
I then tried the following java script:
var str="Parameter 1 = 42";`
var res=str.replace(/(?<=Parameter 1 =).*$/, "11");
alert(res);
However, that gives me an error when I run it using iMacros:
SyntaxError: invalid regexp group, line 6 (Error code: -991)
p.s. I do not understand why my question has been marked as [duplicate] and closed?