09-10-2020 02:04 PM
Hello. I am having some issues getting “replace” to work the way I want; kindly have a look.
This works:
$Name.replace(/ron/gi, “Ronald”)
So does this:
$Name.replace($OldName, $NewName)
But, I want the above to also work with the “gi” option but it does not, e.g.:
$Name.replace(/$OldName/gi, $NewName)
Has anyone handled this before? If so, kindly share your solution. Thanks.
Solved! Go to Solution.
09-11-2020 10:48 AM
There may be a better option, but eval will probably work:
eval("$Name.replace(/" + $OldName + "/gi,$NewName)")
09-11-2020 10:48 AM
There may be a better option, but eval will probably work:
eval("$Name.replace(/" + $OldName + "/gi,$NewName)")
09-12-2020 09:10 AM
That will work @del . Thanks for the tip.