Answers for "js make replace() replace multiple characters"

2

js replace multiple

string.replace('find1', 'replace1').replace('find2', 'replace2');
Posted by: Guest on August-04-2021
1

replace many chracters js

// You can use regex to do it in only one replace
// Using the or: |
var str = '#this #is__ __#a test###__';
str.replace(/#|_/g,''); // result: "this is a test"
// Or using the character class 
str.replace(/[#_]/g,''); // result: "this is a test"
Posted by: Guest on September-21-2020

Code answers related to "js make replace() replace multiple characters"

Code answers related to "Javascript"

Browse Popular Code Answers by Language