var str = "/* \n" +
"$foo = 1 + 2; \n" +
"$foo = $foo; \n" +
"print $foo;\n" +
"*/";
var str2 = "/* \n" +
"$foo = 1 + 2; \n" +
"$foo = $foo; \n" +
"print $foo;";
alert( /\/\*([\S\s]*?)(?:\*\/|$)/.exec( str ) );
alert( /\/\*([\S\s]*?)(?:\*\/|$)/.exec( str2 ) );