The tokens are {{small-images}}, {{medium-images}}, {{images}}, {{xl-images}}, and {{xxl-images}}
I want to take the first one found, and then replace all the others with that.
Then I want to replace all the tokens with a given string.
But I can't seem to get past the first part...
As a test, I'm running:
Code: Select all
$pattern = "/{{([a-zA-Z]-)?images}}/";
$string = "this is a test {{small-images}}. Yep{{medium-images}} and {{images}} and {{xl-images}} and {{xxl-images}}.";
if (preg_match($pattern, $string, $matches)) {
echo preg_match($pattern, $string) . " matches found:<br />";
print_r($matches);
}