Last active
August 29, 2015 14:06
-
-
Save island205/0d36e6958122cf4ed04e to your computer and use it in GitHub Desktop.
stripCommentTag
This file contains hidden or 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
var STRIP_COMMENT_TAG_REGEXP, end, start, stripCommentTag, testStringA, testStringB; | |
STRIP_COMMENT_TAG_REGEXP = /<!--(.|\s)*?-->/gm; | |
stripCommentTag = function(html) { | |
return html.replace(STRIP_COMMENT_TAG_REGEXP, ""); | |
}; | |
testStringA = '<!-- -->'; | |
testStringB = '<!-- '; | |
console.log('A', testStringA, testStringA.length); | |
start = new Date; | |
console.log(stripCommentTag(testStringA)); | |
end = new Date; | |
console.log('cost', end.getTime() - start.getTime()); | |
console.log('B', testStringB, testStringB.length); | |
start = new Date; | |
console.log(stripCommentTag(testStringB)); | |
end = new Date; | |
console.log('cost', end.getTime() - start.getTime()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment