I know that this can be done using settings in Outlook, but that only sorts the issue for myself.
What I would like to do is use PHP to prevent text from being hyperlinked just because there is an @ sign etc…
As far as I can see, the only option for me is to encode all @ signs to their HTML numeric entity like so:
Something like this:
$message = str_replace('@','@',$message);
However, if possible, I do not want this to happen if the @ sign is part of an email address.
Therefore I need something like this:
// SOME_REGEX will match any @ sign that is NOT part of an email address
$message = preg_replace('SOME_REGEX','@',$message);
Can anybody think of any other better methods? Are there any flaws in this plan? Can anyone suggest a good regular expression for this? I am struggling to write a regex that matches an @ sign if it is not part of an email address
Thanks in advance
This will not work if the email address is wrapped in anything not defined in the trim list.
Good luck.