I want to filter the input text if it’s got A URL inside it.
By URL I mean that every thing that corresponds to a valid internet address like www.example.com, example.com, http://www.example.com, http://example.com/foo/bar.
I think I’ve gotta use regular expressions and the preg_match function so I need the correct regexp pattern for this purpose.
I’d be very grateful if anybody could give me that.
This article has a nice regex for matching urls: http://daringfireball.net/2010/07/improved_regex_for_matching_urls
For PHP you would need to escape the regex properly, for example like this: