Posted on: 7/30/2012 9:16:13 PM | Views : 1385

Hi,

I would like to be able to wrap the long links and make it short, using the below code, is it possible?

Thank you!
The below code converts string to links when find http, https, www:
string str = xstr; // = TextBox1.Text; System.Text.RegularExpressions.Regex re = new Regex(@"(http|https|www):\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?"); System.Text.RegularExpressions.MatchCollection mc = re.Matches(str); foreach (Match m in mc) { str = str.Replace(m.Value, "<a href=" + m.Value + " target=_blank" + ">" + m.Value + "</a>"); } return str;


...

Go to the complete details ...