jamesp0tter
Programmer
Hello,
I have the following code:
and I need to match them with a preg_replace function...
At first, I only had one
at a time, so
worked fine.
But now that I have more than one, that preg_replace matches the first line's TestBeginXX and the last line's TestBeginXX (being this last XX different from the first one).
I would need some preg_replace pattern that would work like this: match first <!--TestBeginXX--> occurence, and then the <!--TestEndXX--> right after it, so that the XX's would match!
Anyone can help ?
Thanks in advance!
jamesp0tter,
mr.jamespotter@gmail.com
p.s.: sorry for my (sometimes) bad english
I have the following code:
Code:
<!--TestBegin12--> sjgidshgifdjhsdh <!--TestEnd12-->
<!--TestBegin22--> ssrvytybsgfhgfjh <!--TestEnd22-->
<!--TestBegin47--> fdhsfdjdfyhhsjfj <!--TestEnd47-->
<!--TestBegin2467--> asfsvffdjhsdh <!--TestEnd2467-->
At first, I only had one
Code:
<!--TestBeginXXXXX--> ??????????????? <!--TestEndXXXXX-->
Code:
$result = preg_replace("#<!--TestBegin(.+?)-->(.+?)<!--TestEnd(.+?)-->#",'[Test=\\1]',$result);
But now that I have more than one, that preg_replace matches the first line's TestBeginXX and the last line's TestBeginXX (being this last XX different from the first one).
I would need some preg_replace pattern that would work like this: match first <!--TestBeginXX--> occurence, and then the <!--TestEndXX--> right after it, so that the XX's would match!
Anyone can help ?
Thanks in advance!
jamesp0tter,
mr.jamespotter@gmail.com
p.s.: sorry for my (sometimes) bad english