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
You can just modify your current regexp to capture everything after the colon up to the first space:
$subject = "E:contact@customer.com I:100955";
$pattern = "/^E:([^ ]+)/";
if (preg_match($pattern, $subject, $m)) {
echo "Yes, A Match";
}
$email = $m[1];
In case you're not familiar with regexp, [^ ]+ means "any character but a space" and it doesn't require a space to be present to work. If for any reason the input changes to "E:email@host.tld" without the " I:12345" bit, it will still work.