how to grab only match value regex php code example
Example: php match copy match
$subject = "E:[email protected] I:100955";
$pattern = "/^E:(?<contact>\w+) I:(?<id>\d+)$/";
if (preg_match($pattern, $subject,$matches)) {
print_r($matches);
}
$subject = "E:[email protected] I:100955";
$pattern = "/^E:(?<contact>\w+) I:(?<id>\d+)$/";
if (preg_match($pattern, $subject,$matches)) {
print_r($matches);
}