I'm using
public function __construct()
{
$this->EE =& get_instance();
$regex = '/(\S+@\S+\.\S+)/';
$replace = '<a href="mailto:$1">$1</a>';
$this->return_data = preg_replace($regex, $replace, ee()->TMPL->tagdata);
}
to find plain text email address and changing them to mailto links, however, the wysiwyg editor is putting the ending paragraph tag right after the link so it's catching the ending tag and putting it in to the mailto link. I need my regex to exclude anything after the .com or .net or whatever. How would I do this?
Right now, it's returning mailto:email@domain.com
, I need to exlude any and all tags that come after the .comHere is a part of the dump, This is what's outputted:
<br />
Preston Newbill<br />
Manager<br />
pnewbill@domain.com</p>