Created
September 15, 2016 17:22
-
-
Save anonymous/0c09ff9ee3d08314edd0d5ccb5c36894 to your computer and use it in GitHub Desktop.
TryCF Gist
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
<!--- JS with comment ---> | |
<cfsavecontent variable="variables.jsWithCommment"> | |
<script type="text/javascript"> | |
// comment | |
var a=1; // another comment | |
/* try{if (...)}; */ | |
var b=2; | |
</script> | |
src="//domain.com" | |
</cfsavecontent> | |
<!--- JS with comment ---> | |
<b>JS with comment:</b><br> | |
<cfdump var="#variables.jsWithCommment#"><br><br> | |
<!--- Replace with first capture for each branch ---> | |
<cfset variables.regex = '(?:("\/\/[^"]*?")|\/\*.*?\*\/|\/\/.*?\n)'> | |
<cfset variables.jsWithoutComment = reReplace(variables.jsWithCommment, variables.regex, "\1", "ALL")> | |
<!--- JS without comment ---> | |
<b>JS without comment(s):</b><br> | |
<cfdump var="#variables.jsWithoutComment#"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment