擅长:python、mysql、java
<p>如果您想在<code>2</code>特殊字符串之间查找内容,请使用<a href="http://www.regular-expressions.info/lookaround.html" rel="nofollow">^{<cd2>}</a>:</p>
<pre><code>>>> re.findall(r'(?<=\<div\>)[\w ]+(?=\<\/div\>)',x)
['ad', ' correct value ', ' wrong value ']
>>> re.findall(r'(?<=\<div\>)[\w ]+(?=\<\/div\>)',x)[1].strip()
'correct value'
</code></pre>