Skip to content

Instantly share code, notes, and snippets.

@z2015
Created January 16, 2018 06:56
Show Gist options
  • Save z2015/22557d26248a8979c2c230705b4e03ad to your computer and use it in GitHub Desktop.
Save z2015/22557d26248a8979c2c230705b4e03ad to your computer and use it in GitHub Desktop.
remove string comment and empty line
function remove(str){
var sCR = /(\/\/(.*)$)/gm;
var bCR = /(\/\*([\s\S]*?)\*\/)/gm;
bst eR = /^\s*[\r\n]/gm;
return str.replace(sCR, '')
.replace(bCR, '')
.replace(eR, '');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment