christa Posted March 6, 2011 Share Posted March 6, 2011 hi using this preg $text = preg_replace ('(([:/~a-zA-Z0-9_\-\.]+)\.([:/~a-zA-Z0-9/?_=]+))', '<a href="$1.$2$3">$1.$2$3</a>', $text); all URLs are correctly resolved except www.somedomain.tld How can I add the www.?? bye Link to comment https://forums.phpfreaks.com/topic/229784-detect-url-in-a-text/ Share on other sites More sharing options...
silkfire Posted March 6, 2011 Share Posted March 6, 2011 Where is your regex delimiter? You need to start and end your regex with the same character for example slash, / Link to comment https://forums.phpfreaks.com/topic/229784-detect-url-in-a-text/#findComment-1183718 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.