0
字符串我想這裏的<p>
標籤之間的字符串:麻煩在VB中使用正則表達式包含 N +空間
<h2>Description</h2>
</div>
<div class="topIdeasDetailsInner clearfix">
<p>There is nothing better than a customized sloth! With this app, you can dress up sloths, face-in-a-hole a sloth, and insert the sloth in any pictures. This app will be like having a small version of photoshop on your phone. </p>
</div>
</div>
在Regexr,我可以使用下面的表達式獲得該字符串:
<div class="topIdeasDetailsInner clearfix">\n <p>?[^>]*<\/p>
但是,當我在VB中使用它並沒有真正的工作。
"<div class=""topIdeasDetailsInner clearfix"">\n <p>(?<Data>[^>]*)<\/p>"
也許在VB中我需要使用特定的表達式來定義「\ n」後面的空格嗎?我試過「*」,但它不工作太...
P.S:我用<Data>
得到我想要的價值所以不介意它。
P.S 2:這是我嘗試,如果你有沒有想過讓我的字符串鏈接:http://www.preapps.com/app-ideas/topic/41/sloth-me
可能是因爲有一個共同的理解,正則表達式[不被認爲是解析HTML/XML的最佳工具](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml -self式標籤)。這就像是問你如何用一把小刀砍掉樹木,然後你有電鋸轟鳴。 – LukStorms
我認爲這是最優化的解決方案,因爲我只需要代碼中的幾個字符串......對於我的情況是否有更好的解決方案? (並感謝您的答案,現在工作正常) –
不知道。但[這是一個示例答案](http://stackoverflow.com/questions/16390441/vb-net-how-do-i-search-through-webpage-source-for-particular-div-and-output-in )使用不同的方法。 – LukStorms