Forum Discussion

ronmwhite's avatar
ronmwhite
New Contributor II
5 years ago
Solved

Replace All Case Insensitive Based on Incoming Value

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...
  • del's avatar
    5 years ago

    There may be a better option, but eval will probably work:

    eval("$Name.replace(/" + $OldName + "/gi,$NewName)")