title: regsub -all and proc
body: <p>I'm writing a recursive procedure, called "subliner3". To be simple it replaces:</p>
  
  <ol>
  <li><code>[object method]</code> with <code>Object-&gt;method()</code></li>
  <li><code>[object method:attr1 attr2 ...]</code> with <code>object-&gt;method(attr1,attr2,...)</code></li>
  </ol>
  
  <p>It is recursive to replace (1) and (2) inside (2). Any attr may be like (1) or (2).</p>
  
  <p>So, this code causes problem:</p>
  
  <pre><code>while {[regsub -all {\[([^\[\]:]+)[:]([^\[\]]+)\]} $subline "[subliner3 "\\1" "\\2"]" subline]} {}
  </code></pre>
  
  <p>This is supposed to find exactly (2) in subline (subline is an attribute list) and call function again for it. The problem is that, when subline is called with regsub's \1 and \2 subliner3 really gets "\1" and "\2", so looks like they are interpreted afted subliner3 call. How can I manage to call [subliner3 "\1" "\2"] with interpreted \1 &amp; \2?</p>
  
  <p>Sample Input: </p>
  
  <pre><code>[self runAction:[CCSequence actions:[CCDelayTime actionWithDuration:5], [CCCallFunc actionWithTarget:self selector:@selector(resetMessage)], nil]]; 
  </code></pre>
  
  <p>Output: </p>
  
  <pre><code>self-&gt;runAction(CCSequence::actions(CCDelayTime::actionWithDuration(5), CCCallFunc::actionWithTarget(self, @selector(resetMessage)), nil);
  </code></pre>