javascript regexp replace code example
Example 1: replace regex javascript
const p = 'lazy dog. If the dog reacted, was it really lazy?';
const regex = /Dog/ig;
p.replace(regex, 'ferret')
// output: lazy ferret. If the ferret reacted, was it really lazy?
Example 2: str replace javascript all
str.replace(/abc/g, '');