删除JavaScript正则表达式中"/*"和"*/"之间的所有内容?

Phi*_*sen 0 javascript regex

如何在JavaScript中删除字符串中的/*和*/(包括这些字符)之间的所有文本?谢谢!

She*_*hef 5

你的正则表达式会是

/\/\*.*?\*\//g
Run Code Online (Sandbox Code Playgroud)

2.替换的JS代码是:

your_str = your_str.replace(/\/\*.*?\*\//g, '');
Run Code Online (Sandbox Code Playgroud)

3.以下是正则表达式的解释:

Match the character "/" literally
Match the character "*" literally
Match any single character that is not a line break character
   Between zero and unlimited times, as few times as possible, expanding as needed (lazy)
Match the character "*" literally
Match the character "/" literally
Run Code Online (Sandbox Code Playgroud)