Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

eregi_replace

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
ferre
Smarty Rookie


Joined: 07 Jul 2003
Posts: 28

PostPosted: Wed Aug 20, 2003 10:49 am    Post subject: eregi_replace Reply with quote

i wanna to change
this {$xxx}
to this {literal}{$xxx}{/literal}

$message = eregi_replace("\\{$([^\\[]*)\\}\\","{literal}{$\\1}{literal}",$message);

but can't run , plz help ....sorry for posting here,its seems about php
Back to top
View user's profile Send private message
andre
Smarty Pro


Joined: 23 Apr 2003
Posts: 164
Location: Karlsruhe, Germany

PostPosted: Wed Aug 20, 2003 11:00 am    Post subject: Reply with quote

You could try this:

Code:
$message = preg_replace('/\{\$(\w+)\}/', "{literal}{\$\\1}{/literal}", $message);


by the way: preg_replace (like used in my code above) is faster than eregi_replace
Back to top
View user's profile Send private message
ferre
Smarty Rookie


Joined: 07 Jul 2003
Posts: 28

PostPosted: Thu Aug 21, 2003 5:30 am    Post subject: Reply with quote

it's work now , thanks !! Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP