Javascript with RegEx works fine elsewhere but gives an error in iMacros

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
viking
Posts: 243
Joined: Sun Mar 16, 2008 7:22 am

Javascript with RegEx works fine elsewhere but gives an error in iMacros

Post by viking » Sun Jul 26, 2020 9:59 am

I am trying to do a search and replace of the characters from the end of "Parameter 1 =" to the end of the line.
For example:
"Parameter 1 = 42" => "Parameter 1 = 11"

The following javascript works elsewhere:

Code: Select all

var str="Parameter 1 = 42";`
var res=str.replace(/(?<=Parameter 1 =).*$/, "11");
alert(res);
However, in iMacros I get an error:

Code: Select all

SyntaxError: invalid regexp group, line 6 (Error code: -991)
p.s. I intend to use this with the EVAL function so that it can also be used in the newer versions of iMacros (that is if I can find out why iMacros throws the error).

Firefox Developer Edition (Portable) v. 55.0b2 (64-bit)
iMacros v. 8.9.7
WIN7 (64 bit)
viking
Posts: 243
Joined: Sun Mar 16, 2008 7:22 am

Re: Javascript with RegEx works fine elsewhere but gives an error in iMacros

Post by viking » Tue Jul 28, 2020 8:38 am

I suspect that the RegEx engine in iMacros may not support look-back?
Post Reply