title: Smarty regex_replace matching expression with curly brackets
body: <p>Can anyone please help me with this...I'm not very good with regular expressions and I'm banging my head since days!</p>
  
  <p>In Smarty I have this array o values included in curly brackets captured in variable $str:</p>
  
  <pre><code>{capture assign=str}{literal}
  {label1: \"value1\",label2: \"value2\", label3: \"value3\",label4: \"value4\"},
  {label1: \"value1b\",label2: \"value2b\", label3: \"value3b\",label4: \"value4b\"},
  ...
  {/literal}{/capture}
  </code></pre>
  
  <p>I need to overwrite a series of labels and values (from { to } ) if label1: \"value1\" match my string.</p>
  
  <p>This is what I got so far...</p>
  
  <pre><code>{capture assign=foo_regex}{literal}/[{label1:\s*\\"{/literal}{$smarty.get.value1}{literal}\\",\s*label2:\s*\\"{/literal}{$smarty.get.value2}{literal}\\"].*[}]/g{/literal}{/capture}
  {capture assign=foo_replace}{literal}{-my new string-}{/literal}{/capture}
  {$str|regex_replace:$foo_regex:$foo_replace}
  </code></pre>
  
  <p>any wizard out there please help ?
  Thank you in advance !</p>
  
  <p>Update:
  I came out with the correct expression, but it's not working with Smarty regex...what am I doing wrong?
  <a href="http://regexr.com?30dnp" rel="nofollow">http://regexr.com?30dnp</a></p>
  
  <p>Update2 @ lorenzo: when <code>label1: \"value1\",label2: \"value2\"</code> matches my string I overwrite it with a new string from { to } like this <code>{label1: \"value1\",label2: \"value2\",label3: \"value3\",label4: \"value4\"}</code></p>
  
  <p>What it does: check if stored value1 and value2 match my test string, if positive -> update all other values (4,5,6) with my new string values.</p>
  
  <p>Hope now it's clearer what I want to achieve.</p>