Skip to content

Instantly share code, notes, and snippets.

@nghiaht
Created July 24, 2019 10:23
Show Gist options
  • Save nghiaht/232216629d98f44b025dac54017b9cc0 to your computer and use it in GitHub Desktop.
Save nghiaht/232216629d98f44b025dac54017b9cc0 to your computer and use it in GitHub Desktop.
replace multiple regex matches in Javascript
var r = /t\-test|test/g; // Note: /g
var input = "these are test t-test";
var output = input.replace(r, "") // Replace matched with ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment