Porsche_maniak
Established Member
Hi !
I was wondering if it is possible to replace the first half of matches using only preg_replace ?
Like i have
The above code gives:
RESULT WANTED
PLS help !
I was wondering if it is possible to replace the first half of matches using only preg_replace ?
Like i have
Code:
[img=some1]
[img=some2]
[img=some3]
[img=some4]
PHP:
$pattern='(\[img=(.*?)\])';
$test=preg_replace($pattern,'replaced',$test);
echo $test;
The above code gives:
Code:
[img=replaced]
[img=replaced]
[img=replaced]
[img=replaced]
RESULT WANTED
Code:
[img=replaced]
[img=replaced]
[img=some3]
[img=some4]
PLS help !