I'm going to slightly change the example above by making it easier to use the elements of the new array easier.
<?php
$str = "This is a #test# string with some #content# in it that I want to #process# today";
$pat = '!#(.*)#!u'; // This is the pattern you're looking for, in this case two #'s
preg_match_all($pat, $str, $matches);
$match_count = count($matches[1]);
$array = array();
for ($a=0; $a < $match_count; $a++)
{
$array[] = $matches[1][$a];
}
echo '<pre>';
print_r($array); // This just prints the contents of the array
echo '</pre>';
?>
Basically what I did here is I added the array $array, where each element is another string matched by the preg_match function. In this example, $array[0] would be "test", $array[1] would be "content", etc etc.