简体   繁体   English

使用vb.net为此源使用合适的正则表达式吗?

[英]Appropriate Regex for this source using vb.net?

Help out a newbie here. 在这里帮助新手。 I am trying to check duplicate content from forum posts. 我正在尝试检查论坛帖子中的重复内容。 So far I have downloaded the source with webclient and tried Regex as well as mshtml without any luck. 到目前为止,我已经通过webclient下载了源代码,并尝试了Regex和mshtml,但没有任何运气。 I am getting the lines with mshtml but not in the way I wanted, means I am not being able to seperate the individual comments. 我正在使用mshtml进行排序,但不是按照我想要的方式进行,这意味着我无法分离单个注释。 The source I am trying to read goes below : 我尝试阅读的资料如下:

<p>
    Hey Alton!</p>
<p>
    I am facing this problem also but i have search on the internet for the solution. There are few things that we need to do to solve this problem.</p>
<p>
    First of all make sure that you have latest drivers for you Graphics Card.</p>

The Codes I have tried so far 到目前为止我尝试过的代码

Regex: 正则表达式:

    Dim r As New System.Text.RegularExpressions.Regex("<p> .* </p>")
    Dim matches As MatchCollection = r.Matches(result)
    For Each itemcode As Match In matches
        ListBox1.Items.Add(itemcode.ToString)
    Next
Dim regexObj As New Regex("<p>(.+?)</p>", RegexOptions.Singleline)
Dim matchResults As Match = regexObj.Match(subjectString)
While matchResults.Success

matchResults = matchResults.NextMatch()
End While

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM