I'm trying to add placeholders to an html file, then replace the placeholders with preg_match_all. This is the output with the below code:
Array ( [0] => Array ( [0] => newsletter_bookmarks][newsletter_cl_post] ) )
it is matching everything from the beginning [ to the very end ]...no matter what I do.
I need to return each placeholder in between the brackets []
Array ( [0] => Array ( [0] => newsletter_bookmarks][newsletter_cl_post] ) )
it is matching everything from the beginning [ to the very end ]...no matter what I do.
I need to return each placeholder in between the brackets []
Code:
$text = "[newsletter_bookmarks][newsletter_cl_post]";
$search = "/[^\[].*[$\]]/"; //search for 'functions'
preg_match_all($search, $text, $matches);
print_r($matches);
[\code]