我想"/* anytext here */"
用空格替换所有出现的 (anytext here
可能是不同类型的文本。)我想要做的是用空格替换所有评论。
我创建了一个正则表达式:
Regex regex = new Regex(@"/\*.*\*/");
...但它不考虑多种/* ... */
模式的存在。例如,这个字符串:
"she /*sells*/ sea shells /*by the*/ sea shore"
...变成:
"she sea shore"
...而我想要的是:
"she sea shells sea shore"
有人可以帮助正确的正则表达式吗?