Skip to content

Instantly share code, notes, and snippets.

@xulapp
Created July 18, 2011 05:26
Show Gist options
  • Save xulapp/1088607 to your computer and use it in GitHub Desktop.
Save xulapp/1088607 to your computer and use it in GitHub Desktop.
arg.match(/(["'])(?:\\\1|(?!\1)[^])*\1|\S+/g).map(function(s) s.replace(/^(["']).*\1$/.test(s) ? /^["']|\\(["'\\])|["']$/g : /\\(["'\\])/g, '$1'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment