Created
January 16, 2018 06:56
-
-
Save z2015/22557d26248a8979c2c230705b4e03ad to your computer and use it in GitHub Desktop.
remove string comment and empty line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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