如何删除 JavaScript 字符串中/* 和 */之间的所有文本(包括这些字符)?谢谢!
最佳答案
1。你的正则表达式是
/\/\*.*?\*\//g
2。进行替换的 JS 代码为:
your_str = your_str.replace(/\/\*.*?\*\//g, '');
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
关于javascript - 删除 JavaScript 正则表达式中 "/*"和 "*/"之间的所有内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22797797/