Skip to content

Instantly share code, notes, and snippets.

@xyfeng
Created September 1, 2017 14:41
Show Gist options
  • Save xyfeng/4fd9ee358b029a1ae94764c1f61e09f8 to your computer and use it in GitHub Desktop.
Save xyfeng/4fd9ee358b029a1ae94764c1f61e09f8 to your computer and use it in GitHub Desktop.
regex/js/comment
/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm
// JavaScript:
// source_string.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, '$1');
// PHP:
// preg_replace("/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/m", "$1", $source_string);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment