use preg_replace_callback. Is this better, ringmaster