var str = "<?php \n" + "/* \n" + " $foo = 1 + 2; \n" + " $foo = $foo; \n" + " print $foo;\n" + "?>"; alert( /\/\*(.|\s)*?\*\//.exec( str ) );