Click here to Skip to main content
15,745,014 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} *****************"
"*********{delimiter} {new string} {delimiter}***********{delimiter} {new string} {delimiter}*****************"
Please help me.Thanks alot.
Updated 18-Mar-14 19:00pm

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