[thelist] regular expression help
misterhaan
misterhaan at track7.org
Sat Mar 31 23:17:54 CDT 2007
how about this:
if(preg_match('/(\{[^\}]\})(.+?)(\{\/[^\}]\})/', $data, $matches)) {
$contents = $matches[2];
$data = str_replace($matches[0], $matches[1] . $matches[3], $data);
}
that should pull out the contents into $contents and remove it from
$data, but keep the delimiters. i didn't test it, and it will only do
it once so if you have more than one delimiter you'd need to loop
instead of using if, and probably store $contents a different way.
More information about the thelist
mailing list