I want to wrap some html elements for gmail address in a given string. How can i do it with php regex.
Input
$string = 'Sample text name@gmail.com another text name2@gmail.com,name2@yahoo.com';
Output I want
$string = "Sample text <div class='gmail'>name@gmail.com</div> another text <div class='gmail'>name2@gmail.com</div>,name2@yahoo.com";