I have a string that looks something like this:
{{imagename.jpg|left|The caption for this image. Includes a variety of chars}}
<p>Some text, lots of paragraphs here.</p>
{{anotherimage.jpg|right|Another caption.}}
What I'm trying to do is to parse out the {{}} bits then pass them through a function. What I have so far is:
function template_function($matches) {
print_r($matches);
}
function parse_images($string) {
$string = preg_replace_callback('!\{\{([^}])\}\}!', 'template_function', $string);
return $string;
}
Can someone give me a hand with the regex so that I end up with the matches being run through print_r?