Can you use two regex in preg_replace to match and replace items in an array? So for example:
Assume you have:
Array
(
[0] => mailto:[email protected]
[1] => mailto:[email protected]
[2] => mailto:[email protected]
[3] => mailto:[email protected]
[4] => mailto:[email protected]
[5] => mailto:[email protected]
[6] => mailto:[email protected]
}
and you have two variables holding regex strings:
$reg = '/mailto:[\w-]+@([\w-]+\.)+[\w-]+/i';
$replace = '/[\w-]+@([\w-]+\.)+[\w-]+/i';
can I:
preg_replace($reg,$replace,$matches);
In order to replace "mailto:[email protected]" with "[email protected]" in each index of the array.