I am finding the external icon added to internal links when the href is absolute, even though they are internal to the site.

Comments

funkytraffic’s picture

This is a mismatch in the regular expression

$reg_exp = '/<a.+?href=\"((http|https|ftp|telnet|news|mms):\/\/.+?)\"[^>]*>(.+?)<\/a>/i';

must be replaced by (any amount of space)

$reg_exp = '/<a\x20+?href=\"((http|https|ftp|telnet|news|mms):\/\/.+?)\"[^>]*>(.+?)<\/a>/i';

or maybe even better (any character but closing the tag)

$reg_exp = '/<a[^>]+?href=\"((http|https|ftp|telnet|news|mms):\/\/.+?)\"[^>]*>(.+?)<\/a>/i';

because <a.+?href

will match

<a href="/internal"></a> any text lines <a href="http://external.com">