title: Extract from string using regex
body: <p>I need to extract a piece of a string. I have to extract from <code>system.cpu.util[,idle]</code> or <code>net.if.out[eth2]</code> respectively <code>idle</code> and <code>eth2</code>.</p>
  
  <p>I don't know how to detect correcty <code>[</code> and <code>]</code> 
  Can someone help me?</p>