title: Match specific text which has square bracket before and after (~ start & end of line)
body: <p>I am looking to match specific parts of text which is surrounded in square brackets. Either the text before a colon up to the word boundary/whitespace before or if no colon exists just the text before the end square bracket. For example</p>
  
  <p><code>[Object testThis:anotherObject];</code> should match <code>testThis</code></p>
  
  <p><code>[Object create];</code> should match <code>create</code></p>
  
  <p><code>[Object create:YES andTest:NO];</code> should match both <code>create</code> as well as <code>andTest</code>.</p>
  
  <p>I was trying something like the following with a look behind to check for an open square bracket and a look ahead to find the close square bracket but I wasn't able to get it to match anything in between.</p>
  
  <pre><code>(?&lt;=\[) .*:(?=\])
  </code></pre>