擅长:python、mysql、java
<p>首先,在这里你不需要向前看。您可以使用这个简单的正则表达式来完成所做的工作:</p>
<pre><code>>>> re.search(r'Title: *(.+?) *<br>', message).group(1)
"Indian Herald: India's Latest News, Business, Sport, Weather, Travel, Technology, Entertainment, Politics, Finance"
</code></pre>
<p>顺便说一下你的正则表达式:</p>
<pre><code>Title: ((?:(?!<br>).)+)
</code></pre>
<p>正在使用<a href="http://www.regular-expressions.info/lookaround.html" rel="nofollow"><strong>negative lookahead</strong></a><code>(?!<br>)</code>在匹配文本<code>Title:</code>后的字符之前检查<code><br></code>是否存在。你知道吗</p>