Regex interpretaion in Django tutorial
<p>despite being familiar with the basics of regex, the tutorial for <a href="https://docs.djangoproject.com/en/1.10/intro/tutorial03/#writing-more-views" rel="nofollow">Django 1.10</a> does not go into much detail about how some regex generates dynamic links. 
I am looking at this specific snippet under the polls/urls.py: </p>

<pre><code>url(r'^(?P&lt;question_id&gt;[0-9]+)/$', views.detail, name='detail'),
</code></pre>

<p>Could someone go into detail about how that regex is interpreted? The quantifiers at the start of the capture group, <code>(?P&lt;question_id&gt;</code> do not make sense to me. Specifically, how does Django know that <code>&lt;question_id&gt;</code> is a foreign key?</p>

<p><strong><code>^(?P&lt;question_id&gt;[0-9]+)/$</code></strong></p>

<pre><code>^ assert position at start of the string
(?P&lt;question_id&gt;[0-9]+) Named capturing group "question_id"
    [0-9]+ match a single character present in the list below:

        Quantifier: + Between one and unlimited times, as many times as possible, 
        giving back as needed [greedy]
        0-9 a single character in the range between 0 and 9

$ assert position at end of the string
</code></pre>

<p>Demo and full explanation: <a href="https://regex101.com/r/zV3rZ1/1" rel="nofollow">https://regex101.com/r/zV3rZ1/1</a></p>

python regex django