python - to extract a specific string
<p>I have a string like :  </p>

<pre><code>    string="(tag, index: develop-AB123-2s), (index: develop-CD123-2s)"
</code></pre>

<p>I want to extract only "develop-CD123-2s", i.e. the string that comes after "(index:" and not the one with tag. How do I do in python? Thanks!</p>

<p><sup>Warning: I'm not the best at regex</sup></p>

<pre><code>import re
s='(tag, index: develop-AB123-2s), (index: develop-CD123-2s)'
print re.findall("\\(.*?index: ([^)]+)", s)[1]  # 'develop-CD123-2s'
</code></pre>

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

<p>Alternative regex</p>

<pre><code>re.findall("index: ([^\s)]+)", s)[1]
</code></pre>

python