creating hyperlinks from plain text

reloadstorino

New Member
I use this code to make plain texts hyperlinks.\[code\] $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '<a target="_blank" href="http://stackoverflow.com/questions/5204384///1">\\1</a>', $text); $text = eregi_replace('(((f|ht){1}tps://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '<a target="_blank" href="http://stackoverflow.com/questions/5204384///1">\\1</a>', $text); $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1<a target="_blank" href="http://\\2">\\2</a>', $text); $text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})', '<a target="_blank" href="mailto:\\1">\\1</a>', $text); \[/code\]But it doesnt work when text is www.domain.com or domain.com or subdomain.domain.comHow can i make it work with them ?Thanks
 
Top