Comment remover

HTML

<textarea>
Removes C/Java/Javascript style comments // and /* */
    Although it will also remove anything that *looks like a comment - e.g. within a string, e.g.:
    myString = "This string has a comment /* comment */ and also ends with one: // ending comment... before end of the string";

    
    
// Test 1
//Test 2
/* Test 3 */
/* Test 4
Is a Mutiline Test */

End of test.
    
</textarea><button>remove comments</button>

CSS

textarea{
    width:500px;
    height:500px;
}

JavaScript

$("button").click(function(){
    $("textarea").val($("textarea").val().replace(/\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\//g,"")); /*remove these comment types*/
    
    $("textarea").val($("textarea").val().replace(/\/\/.*/g,"")); // remove these comment types
    
});