Removes the regular expression for the comment statement in javascript


function removeJsComments(code)  
{    
    return code.replace(/(?:^|n|r)s*/*[sS]*?*/s*(?:r|n|$)/g, 'n').replace(/(?:^|n|r)s*//.*(?:r|n|$)/g, 'n'); 
}

Multi-line comments:

/(?:^|n|r)s*/*[sS]*?*/s*(?:r|n|$)/g

Single line comment:

/(?:^|n|r)s*//.*(?:r|n|$)/g