preg_match ('/(foo)(bar)(baz)/', 'foobarbaz', $matches, PREG_OFFSET_CAPTURE); print_r ($matches);
http://php.net/manual/zh/function.preg-match.php