PHP preg_replace adding http:// only when missing
Often people post links in our classifieds that start just with just www. or nothing at all (for instance www.blahblah.com or blahblah.com).
I need a preg_replace function that will add http:// to any link that doesn't have it.
So if a link is: www.blahblah.com it should become http://www.blahblah.com
If a links is blahblah.com it should become http://blahblah.com
This is the preg_replace line that needs to be filled: $text = preg_replace( '//', "", $text);
Thank you for any suggestions.