In perl regex we can extract the matched variables, ex below.
# extract hours, minutes, seconds
$time =~ /(\\d\\d):(\\d\\d):(\\d\\d)/; # match hh:mm
Check the php manual
int preg_match ( string $pattern , string $subject [, array &$matches [, int $flags [, int $offset ]]] )
If matches is provided, then it is filled with the results of search. $matches[0] will contain the text that matched the full pattern, $matches1 will have the text that matched the first captured parenthesized subpattern, and so on.
$subject = "E:contact@customer.com I:100955";
$pattern = "/^E:(?\w+) I:(?\d+)$/";
if (preg_match($pattern, $subject,$matches)) {
print_r($matches);
}