Hey everyone.
I need some help i need to look through text and find links. if the text has www.mysite.com it will change it to http://www.mysite.com. I basically have
some text that may have <img> tag but if i put www.mysite.com/image.jpg it will not show unless i have http://
I also want to convert links to clickable. currently I have
$text = html_entity_decode($text);
$text = $text;
$text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'<a href="\\1" target=_blank>\\1</a>', $text);
$text = eregi_replace('(((f|ht){1}tps://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'<a href="\\1" target=_blank>\\1</a>', $text);
$text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'\\1<a href="http://\\2" target=_blank>\\2</a>', $text);
$text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})',
'<a href="mailto:\\1" target=_blank>\\1</a>', $text);
return $text;
but this code ruins if i actually have a <img src="http://www.mysite.com/image.jpg" />