I need a regex or something to remove this kind of comments.
/*!
* Foo Bar
*/
I tried with /(\/*!.**\/)/m
but fails. Any Suggestion?
I need a regex or something to remove this kind of comments.
/*!
* Foo Bar
*/
I tried with /(\/*!.**\/)/m
but fails. Any Suggestion?
Simple regexps for removing (c-style) single-line and multi-line comments. But note that those are really simple - for example they don't take possibility of /* */ inside a string literal. But should be fine for removing comments from a simple code:
I would highly suggest removing these comment with Google's Closure Compiler, I have used it in production and it's fantastic.
Well i think i got what you want :)
Kindly save this script as HTML and then run it in your browser then copy your javascript and put it in the texterea and then condense it with the button
This code will remove the spaces and comments on your code so please dont forget end your functions with ; to avoid syntax error.
This will help you reducing your javascript files size this will put ur javascript in 1 line , so if you need it back as well formed u can use this addon in firefox if u use it http://www.formatjavascript.com/
Regards :) please mark this answer as the correct one if u see it useful
You need to escape the
*
too:check this out: http://www.rubular.com/r/n2bV9qUD6k
You could use a javascript compressor like YUI compress or Google Closure Compiler
*
has to be escaped, otherwise it matches zero or more occurences of/
(in case of\/*
). There is an syntax error as well in.**
. Try the next RE with*
properly escaped: