【发布时间】:2019-02-21 01:18:00
【问题描述】:
我正在尝试删除我的代码的以下部分:
<!--
NewPP limit report
Preprocessor node count: 1/300000
Post‐expand include size: 0/2097152 bytes
Template argument size: 0/2097152 bytes
Expensive parser function count: 0/100
-->
<!-- Saved in parser cache with key creepypasta:pcache:idhash:29041-0!*!*!*!*!2!* -->
我尝试了以下方法:
body = Regex.Replace(body, @"(<!-- (.*?) -->", "");
但我收到一个错误:
解析不够。正则表达式
我可以使用正则表达式删除上面的代码块吗?
它从这个 url http://creepypasta.wikia.com/wiki/She_Was_Asking_for_It 返回正则表达式的以下代码
【问题讨论】:
-
究竟会返回什么?
-
抱歉,更新了我的 OP。
-
不,不是屏幕截图,将从您提供的示例和处理后的 example 文本中删除什么。不是原始来源。
-
.默认不匹配换行符。RegexOptions.Singleline使.能够匹配换行符。而第一个(只需要删除。