擅长:python、mysql、java
<p><code>(.+)</code>是贪婪的。它会尽其所能,并在需要时给予回报。</p>
<p><code>(.+?)</code>是不清晰的。它需要尽可能少的。</p>
<p>见:</p>
<pre><code>delegate
[delegate] /^(.+)e/
[de]legate /^(.+?)e/
</code></pre>
<p>此外,比较“Regex调试器日志”<a href="http://regex101.com/r/iB5dI0/1" rel="nofollow">here</a>和<a href="http://regex101.com/r/iB5dI0/2" rel="nofollow">here</a>将显示ungreedy修饰符更有效的作用。</p>