title: Ruby String split with regex
body: <p>This is <strong>Ruby 1.8.7</strong> but should be same as for 1.9.x</p>
  
  <p>I am trying to split a string for example:</p>
  
  <pre><code>a = "foo.bar.size.split('.').last"
  # trying to split into ["foo", "bar","split('.')","last"]
  </code></pre>
  
  <p>Basically splitting it in commands it represents, I am trying to do it with Regexp but not sure how, idea was to use regexp</p>
  
  <pre><code>a.split(/[a-z\(\)](\.)[a-z\(\)]/)
  </code></pre>
  
  <p>Here trying to use group <code>(\.)</code> to split it with but this seems not to be good approach.</p>