Created
July 24, 2019 10:23
-
-
Save nghiaht/232216629d98f44b025dac54017b9cc0 to your computer and use it in GitHub Desktop.
replace multiple regex matches in Javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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