Skip to content

Instantly share code, notes, and snippets.

@florianpasteur
Created February 3, 2021 15:16
Show Gist options
  • Save florianpasteur/049fc5107586f16dd6c415f14b3a37e8 to your computer and use it in GitHub Desktop.
Save florianpasteur/049fc5107586f16dd6c415f14b3a37e8 to your computer and use it in GitHub Desktop.
Surprising Search & Replace in JS
tag = "Some value";
replacetag = '<span class="hightlighttag">' + tag + '</span>';
console.log(textarea.value.split(tag).join(replacetag))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment