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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.