我有一個字符串,我需要從該字符串解析的電子郵件ID。我已經使用PHP正則表達式進行檢索並正常工作。但我的問題是,如果電子郵件前綴包含正則表達式。電子郵件正則表達式PHP
<?php
$convert = "mailto:[email protected]";
preg_match_all('/mailto:(.*?)(.com|.org|.net|.in)/', $convert, $emails);
echo "<pre>";
print_r($emails);
echo "</pre>";
?>
輸出:
陣列 (
[0] => Array
(
[0] => mailto:xxxin
)
[1] => Array
(
[0] => xx
)
[2] => Array
(
[0] => xin
)
)
但我期待[0] => [email protected]
。請幫我實現這一點。
給定的字符串將作爲不同的電子郵件在整個字符串中重複。 –
請舉例.. –
$ convert =「mailto:[email protected],mailto:[email protected]」; –