Let's say somebody post URLs that look like this: http:/ /something.com. http:/ /something.org. http:/ /something.info. or like this: http:/ /something.com... http:/ /something.org... http:/ /something.info... or like this: ...http:/ /something.com ...http:/ /something.org ...http:/ /something.info Is there a way to clean up URLs from any dots that are not supposed to be there? Any input will be appreciated.
Thanks, ThePHPMaster. Here's what I am using. Was poking around and came upon this somewhere: $text = preg_replace( '/(\b)(http|ftp|https|mailto)([\:\/\/])([A-z0-9~!@$%&*()_+:?,.\/;=#-]{2,}[A-z0-9~@$%&*_+\/=])/', " $2$3$4 ", $text); Code (markup): I decided to simply put a space on each end of a link, instead of trying to strip all / any characters that may come in contact with it (which in my case used to interfere with a link's accuracy). It's not perfect, it won't work with domain names ending in .com.de or .org.uk, etc. but other than that I am pretty happy with it. Thanks for the suggestion.