Python Regex and group function
<p>Hi trying to separate each of the expressions from the colon.  So want to obtain 'ss_vv', 'kk' and 'pp'.  But the two print expressions below give me 'v' and 'k', so getting parts only of each string.  Can anyone see what wrong here?       </p>

<pre><code>m0 = re.compile(r'([a-z]|_)+:([a-z]|_)+:([a-z]|_)+')
m1 = m0.search('ss_vv:kk:pp')
print m1.group(1)
print m1.group(2)
</code></pre>

<p>No need to use regex for your case. You can just split on basis of ':' and get required output..</p>

<pre><code>&gt;&gt;&gt; a = 'ss_vv:kk:pp'
&gt;&gt;&gt; b_list = a.split(':')
&gt;&gt;&gt; b_list
['ss_vv', 'kk', 'pp']
&gt;&gt;&gt;
</code></pre>

python regex