Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

replace regex javascript

const p = 'Dog dog';
const regex = /Dog/gi;
console.log(p.replace(regex, 'ferret'));
// expected output: "ferret ferret"
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #replace #regex #javascript
ADD COMMENT
Topic
Name
6+3 =