Skip to content

Instantly share code, notes, and snippets.

@rtanikella
Created November 16, 2016 20:58
Show Gist options
  • Save rtanikella/bc9ac2cc04fc75ee2d0d46cd410eb429 to your computer and use it in GitHub Desktop.
Save rtanikella/bc9ac2cc04fc75ee2d0d46cd410eb429 to your computer and use it in GitHub Desktop.
A one-liner to decode a URI in Node.js (I use this in REPL mode)
// Note that in Node.js REPL mode the ':' and ',' are not decoded by decodeURI(). Hence the regexes.
decodeURI("Text to decode").replace(/%2C/g,",").replace(/%3A/g,":");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment