Thread: Regex help?
View Single Post
Old 02-09-2010, 05:45 PM   #2 (permalink)
gamer13
The Wanderer
 
gamer13's Avatar
 
Join Date: Sep 2009
Posts: 15
Thanks: 4
gamer13 is on a distinguished road
Default

You could use preg_replace_callback() to replace that part with a gallery:

PHP Code:
<?php

function gallery($path_to_images)
{
    
// do something and return it:
    
return;
}

$text 'Hello world!
{gallery=/path/to/images}
Another world!'
;

$new_text preg_replace_callback('/^{gallery=(.*?)}$/''gallery'$text)
Not tested...
gamer13 is offline  
Reply With Quote