REGEX formulating conditions
<p>Just started learning python and regex. </p>

<pre><code>My regex:
\b\d+\s+([A-Za-z]* |[A-Za-z]*\s+[A-Za-z]*)\s+\D+..
</code></pre>

<p>using <a href="https://regex101.com/" rel="nofollow">https://regex101.com/</a> </p>

<p><strong>string 1:</strong> <a href="https://i.imgur.com/XNuXftW.jpg" rel="nofollow">https://i.imgur.com/XNuXftW.jpg</a> (why does Beer has whitespaces while carrot/chocolate dont have?)</p>

<p><strong>string 2</strong><a href="https://i.imgur.com/nrl2FPB.jpg" rel="nofollow">https://i.imgur.com/nrl2FPB.jpg</a>  (adding further more of \s+[A-Za-z] in the capture group doesnt seem to be working anymore, WHY?)</p>

<p><strong>string 3</strong>: <a href="https://i.imgur.com/qH0Z7Hi.jpg" rel="nofollow">https://i.imgur.com/qH0Z7Hi.jpg</a> (same as string 2 problem)</p>

<p>my question is how do i continue to formulate such that it will encompass the above conditions? thank you</p>

<p>in the case that you need to test it yourself, i have provided the strings as below.</p>

<p>=</p>

<p>Try this:</p>

<pre><code>\d+\s+([A-Za-z ]*)\b *\D+
</code></pre>

<p>See on <a href="https://regex101.com/r/rlFheb/2" rel="nofollow">regex101</a>.</p>

python regex