diff --git a/plugins/content/emailcloak/emailcloak.php b/plugins/content/emailcloak/emailcloak.php index 503f507430b11..d6266af9ae225 100644 --- a/plugins/content/emailcloak/emailcloak.php +++ b/plugins/content/emailcloak/emailcloak.php @@ -479,8 +479,12 @@ protected function _cloak(&$text, &$params) $text = substr_replace($text, $replacement, $regs[0][1], strlen($regs[0][0])); } - // Search for plain text email@example.org - $pattern = '~' . $searchEmail . '([^a-z0-9]|$)~i'; + /* + * Search for plain text email addresses, such as email@example.org but not within HTML tags: + * or + * The negative lookahead '(?![^<]*>)' is used to exclude this kind of occurrences + */ + $pattern = '~(?![^<>]*>)' . $searchEmail . '~i'; while (preg_match($pattern, $text, $regs, PREG_OFFSET_CAPTURE)) {