擅长:python、mysql、java
<p>还有一个(Python):</p>
<pre><code>(?<=/)(?=/)|[^/]+
</code></pre>
<p><a href="https://regex101.com/r/wuhYAo/2/" rel="nofollow noreferrer">Start your engine!</a></p>
<pre><code>(?<=/) : use a positive lookbehind to assert match is preceded by '/'
(?=/) : use a positive lookahead to assert match is followed by '/'
| : or
[^/]+ : match 1+ characters other than '/'
</code></pre>
<p>将<code>[^/]+</code>更改为<code>[^/\n]+</code>,以防止匹配项跨越行终止符</p>