我想在<p>
标记之间获取此字符串:
<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
答案 0 :(得分:2)
您不需要对空格进行硬编码 只需使用带*(0或更多)或+(1或更多)
的\ s<div\s+class="topIdeasDetailsInner clearfix">\s*<p>([^<]*)<\/p>
围绕你需要的东西()将它放入一个捕获组。