Jump to content

Problem evaluating code with {}


silviuchingaru

Recommended Posts

I have the folowing subject:

[code]<table border="1" class="dashed">
 <tr>
   <th class="title">{title}</th>
 </tr>
<!--loopStartLink-->
 <tr>
   <td>{link}</td>
 </tr>
<!--loopEndLink-->
</table>[/code]

and the folowing preg_match shoud change an tag like {link} only if array $tags['link'] is set, else it should leave the tag unchanged:

[code]preg_replace("/\{(\w+)\}/e",'!$tags["\\1"]?"{\\1}":$tags["\\1"]',$output);[/code]

it works perfect without the } like this:

[code]preg_replace("/\{(\w+)\}/e",'!$tags["\\1"]?"{\\1":$tags["\\1"]',$output);[/code]

and writes only {link but I have to write full tag like {link}.

What is the problem? Why when I add } it doesn't work. Is there a way to escape } (I tried with \} but doesn't work).

Please help!
Thank's!
Link to comment
https://forums.phpfreaks.com/topic/35048-problem-evaluating-code-with/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.