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:ss format
$hours = $1;
$minutes = $2;
$seconds = $3;
How to do this in php?
$subject = "E:[email protected] I:100955";
$pattern = "/^E:/";
if (preg_match($pattern, $subject)) {
echo "Yes, A Match";
}
How to extract the email from there? (We can explode it and get it...but would like a method to get it directly through regex)?