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 Quote 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, / Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.