imvain2
Apr 27th 2008, 9:01 pm
I have the below code that "kind of" works.
$content = "Zs dasd jasjd asjdo asjio [mytag 0970897890,222,11] das jio das idopas s sjiopd sd [mytag 123456,356,66]";
preg_match_all("/\[mytag (.+?)\]/ise", $content,$matches);
$X=0;
foreach($matches as $var){
echo $var[$X] . "<br>";
$X+=1;
}
the output is:
[mytag 0970897890,222,11]
123456,356,66
when I just want:
0970897890,222,11
123456,356,66
---------------------------
i know I can use str_replace in my loop to clean the output, however I would like to fix the actual problem with the regular expression.
$content = "Zs dasd jasjd asjdo asjio [mytag 0970897890,222,11] das jio das idopas s sjiopd sd [mytag 123456,356,66]";
preg_match_all("/\[mytag (.+?)\]/ise", $content,$matches);
$X=0;
foreach($matches as $var){
echo $var[$X] . "<br>";
$X+=1;
}
the output is:
[mytag 0970897890,222,11]
123456,356,66
when I just want:
0970897890,222,11
123456,356,66
---------------------------
i know I can use str_replace in my loop to clean the output, however I would like to fix the actual problem with the regular expression.