//数据
var a = "/*hello world*/";
var b = "//hello world";
var c = "/*line_1line_2line_3*/";
var d = "//hello/*world*/";
//正则
var reg_1 = /(\/\*.+\*\/)/ig;
var reg_2 = /(\/\/[^\n]+)/ig;
//测试
reg_1.exec(a);
reg_2.exec(b);
reg_1.exec(c);
reg_2.exec(d);
测试都通过了,希望对楼主有帮助~