擅长:python、mysql、java
<p><a href="https://www.regular-expressions.info/dot.html" rel="nofollow noreferrer">dot</a>与换行符不匹配,因此可以使用<a href="https://www.regular-expressions.info/modifiers.html" rel="nofollow noreferrer">modifier</a><code>(?s)</code>或<a href="https://docs.python.org/2/library/re.html#re.S" rel="nofollow noreferrer">re.S</a>或<a href="https://docs.python.org/2/library/re.html#re.DOTALL" rel="nofollow noreferrer">re.DOTALL</a></p>
<pre><code>pattern = re.compile(r"(.*)(?=Telephone)", re.S)
</code></pre>
<p>或</p>
<p><code>pattern = re.compile(r"(?s)(.*)(?=Telephone)")</code></p>
<p>您也可以在不使用组的情况下获得匹配:</p>
<p><code>(?s).*(?=Telephone)</code></p>