Click here to Skip to main content
14,770,794 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I want to replace dynamic string value between certain prefix and suffix delimiter for multiple match. By using preg_replace() method in php I can set value between delimiter with following pattern. but it only works for last match.
_________________________________________________________________________________________
preg_replace("#(.*)$delimit(.*?)$delimit(.*)#is", "$1$attr=$delimit$inject$delimit$3", $contents);
_________________________________________________________________________________________
Please help me, how can I achieve this. and how to handle unpredictable white space between delimiter

"********* {delimiter} {old string} {delimiter}************{delimiter} {old string} {delimiter} *****************"
to
"*********{delimiter} {new string} {delimiter}***********{delimiter} {new string} {delimiter}*****************"
Please help me.Thanks alot.
Posted
Updated 18-Mar-14 20:00pm
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900