Skip to content

Instantly share code, notes, and snippets.

@chris-sev
Last active December 1, 2018 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chris-sev/d1d233fb4ff5264cd50b8208a03dcf84 to your computer and use it in GitHub Desktop.
Save chris-sev/d1d233fb4ff5264cd50b8208a03dcf84 to your computer and use it in GitHub Desktop.
Replace All \- with -
const myUrl = 'this\-is\-my\-url';
// myMessage.replace(/\\-/g, '-');
// or
const newUrl = myUrl.replace(new RegExp('\-', 'g'), '-');
console.log(newUrl); // this-is-my-url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment