capture all matches in regex (g modifier not working for me)
<p>If I want to capture all of the last term in each product in this pattern:</p>

<pre><code>PatternAnchor: Product-Computer-Keyboard, 
Product-Computer-Monitor, Product-Computer-Motherboard PatternEnd:
</code></pre>

<p>I tried this:</p>

<pre><code>PatternAnchor: Product-(.*?)-(?P&lt;Item&gt;.*?)(,|PatternEnd:)
</code></pre>

<p>but I still only get the first match.</p>

<p><a href="https://regex101.com/r/cR0aG8/1" rel="nofollow">https://regex101.com/r/cR0aG8/1</a></p>

<p>In Python, you may just use a 2 step approach:</p>

<ul>
<li>Check if the <code>PatternAnchor:</code> is present at the start of the string (note: this step might also be done with a regex in case of a more complex string)</li>
<li>If yes, find all the patterns you need with a shorter <code>r'\bProduct-(.*?)-(?P&lt;Item&gt;.*?)(?:,|PatternEnd:)'</code> pattern.</li>
</ul>

<p>See this <a href="http://ideone.com/HKfAS8" rel="nofollow">Python demo</a>:</p>

<pre><code>import re
pat = r'\bProduct-(.*?)-(?P&lt;Item&gt;.*?)(?:,|PatternEnd:)'
s = 'PatternAnchor: Product-Computer-Keyboard, Product-Computer-Monitor, Product-Computer-Motherboard PatternEnd:'
res = []
if (s.startswith("PatternAnchor: ")):
    res = re.findall(pat, s[15:])
print(res)
</code></pre>

python regex