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>One way is using python regex - <a href="https://docs.python.org/2/library/re.html" rel="nofollow">positive lookbehind assertion</a></p>

<pre><code>import re
string = "(tag, index: develop-AB123-2s), (index: develop-CD123-2s)"
re.findall(r"(?&lt;=\(index:) ([^)]+)", string)
</code></pre>

<p>This pattern only matches things that start with <code>(index:</code>. You can also look at negative lookbehind assertions to try and match the <code>(tag,</code> part.</p>

python