C# code to linkify urls in a string
问题 Does anyone have any good c# code (and regular expressions) that will parse a string and \"linkify\" any urls that may be in the string? 回答1: It's a pretty simple task you can acheive it with Regex and a ready-to-go regular expression from: http://regexlib.com/ Something like: var html = Regex.Replace(html, @"^(http|https|ftp)\://[a-zA-Z0-9\-\.]+" + "\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?" + "([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*$", "<a href=\"$1\">$1</a>"); You may also be interested not only in