replaceAllRegex

This tag does a string replace all with a regex.

Created by: hackvertor
Installed 1 times

Category: String

Created on: Tuesday, September 24, 2024 at 11:42:50 AM

Updated on: Tuesday, September 24, 2024 at 11:42:50 AM

This is a built in tag

Tag arguments
[
   {
      "type": "string",
      "help": "This is used to find the string",
      "defaultValue": "regex"
   },
   {
      "type": "string",
      "help": "This is used to replace the string",
      "defaultValue": "replace"
   }
]
Code
class replaceAllRegex {
  encode(input, regex, replace) {
     return input.replaceAll(new RegExp(regex,"g"), replace);
  }
}