Extract sub path from url with regex
<p>I have this url:</p>

<pre><code> http://www.example.com/en/news/2016/07/17/1207151/%D9%81%D8%AA%D9%88%D8%A7%DB%8C-%D8%B1%D9%87%D8%A8%D8%B1-
</code></pre>

<p>I am going to extract <code>1207151</code> here.</p>

<p>here is my regext:</p>

<pre><code>pattern = '(http[s]?:\/\/)?([^\/\s]+\/)+[^/]+[^/]+[^/]+[^/]/(?&lt;field1&gt;[^/]+)/'
</code></pre>

<p>but it's wrong!</p>

<p>what is my mistake?</p>

<pre><code>import re
print re.search(r'.*/([^/]+)/.*',s).group(1)
</code></pre>

python regex url