擅长:python、mysql、java
<p>您可以在<code>findall</code>中使用这个基于lookahead的正则表达式:</p>
<pre><code>>>> s='http://pastebin.com/XXXXXXXhttp://pastebin.com/XXXXXX\r'
>>> re.findall(r'https?://.+?(?=https?://|[\r\n]|$)', s)
['http://pastebin.com/XXXXXXX', 'http://pastebin.com/XXXXXX']
</code></pre>
<p><code>(?=http://|[\r\n]|$)</code>是断言下一个位置有<code>http://</code>或<code>\r</code>或<code>\n</code>或行结束的正向前瞻</strong>。你知道吗</p>
<p><a href="https://regex101.com/r/fD7kH2/2" rel="nofollow">RegEx Demo</a></p>