Dev log
Replace text in a string with JavaScript
replace() changes the first match. replaceAll() or a regex with the g flag changes every match. Also case-insensitive swaps, $ patterns and escaping input.
4 min read
Tag
replace
Dev log
Replace text in a string with JavaScript
replace() changes the first match. replaceAll() or a regex with the g flag changes every match. Also case-insensitive swaps, $ patterns and escaping input.
4 min read