JSFiddle - React, Tailwind, and code Playground
HTML
Valid Javascript<br>
<textarea id="input" rows="15" cols="68">/* block 1 multi
*/
var b = function(){ /* block 2 contained */ };
"/* invalid block */";
"\" /* invalid block tricky */";
"\\ \\\""; /* valid block tricky */
// Ignore Case: note - collapse regex first, then block comments
var trickiest = /\/* invalid block trickiest */gmi;
</textarea><br><br>
Result<br>
<textarea id="output" rows="10" cols="68"></textarea>
JavaScript
var matchBlockComments = /(?:\n|^)(?:[^'"])*?(?:'(?:[^\\\r\n]|[\\]{2}|\\')*'|"(?:[^\\\r\n]|[\\]{2}|\\")*")*?(?:[^'"])*?(\/\*(?:[\s\S]*?)\*\/)/g;
var code = document.getElementById("input").value;
var matches = matchBlockComments.exec(code);
document.getElementById("output").value = matches.join('\n\n');