silviuchingaru Posted January 21, 2007 Share Posted January 21, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/35048-problem-evaluating-code-with/ Share on other sites More sharing options...
effigy Posted January 22, 2007 Share Posted January 22, 2007 I'm not sure what you're trying to say; your first regex works fine. What version of PHP are you running? Quote Link to comment https://forums.phpfreaks.com/topic/35048-problem-evaluating-code-with/#findComment-166358 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.