你好,我对这个正则表达式有点麻烦
我想删除以下列
开头和结尾的所有内容以:-->
结束于:<!-- <rdf:RDF xmlns:rdf="/web/20120124023607/http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="/web/20120124023607/http://purl.org/dc/elements/1.1/"
xmlns:trackback="/web/20120124023607/http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description rdf:about="/web/20120124023607/http://www.flatfeets.com/flat-feet-foot-definition/"
dc:identifier="/web/20120124023607/http://www.flatfeets.com/flat-feet-foot-definition/"
dc:title="What Is Flat Feet Or Flat Foot ?"
trackback:ping="/web/20120124023607/http://www.flatfeets.com/flat-feet-foot-definition/trackback/" />
-->
要删除的字符串示例:
Function StripGarbage(ByVal article As String) As String
Return Regex.Replace(article, "<!--(.+?)-->", "")
End Function
我的代码无效:
{{1}}
答案 0 :(得分:2)
使用[\S\s]
代替.
,它允许正则表达式跨多行匹配