<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Automatically Hyperlink URLs and E-Mail Addresses in ASP.NET Pages with C#</title>
	<atom:link href="http://www.hotscripts.com/blog/automatically-hyperlink-urls-and-e-mail-addresses-in-asp-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hotscripts.com/blog/automatically-hyperlink-urls-and-e-mail-addresses-in-asp-net/</link>
	<description></description>
	<lastBuildDate>Thu, 22 Dec 2011 22:14:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Pete Soheil</title>
		<link>http://www.hotscripts.com/blog/automatically-hyperlink-urls-and-e-mail-addresses-in-asp-net/comment-page-1/#comment-184</link>
		<dc:creator>Pete Soheil</dc:creator>
		<pubDate>Sun, 14 Mar 2010 20:07:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.hotscripts.com/blog/?p=759#comment-184</guid>
		<description>Looks like the blog system filtered out the HTML tags from the code. The correct version is identical to the original except there is a &quot;$1&quot; where the URL is suppose to go in the Replace function.

Pete
.-= Pete Soheil&#180;s last undefined ..&lt;a href=&quot;0&quot; rel=&quot;nofollow&quot;&gt;If you register your site for free at &lt;/a&gt; =-.</description>
		<content:encoded><![CDATA[<p>Looks like the blog system filtered out the HTML tags from the code. The correct version is identical to the original except there is a &#8220;$1&#8243; where the URL is suppose to go in the Replace function.</p>
<p>Pete<br />
.-= Pete Soheil&#180;s last undefined ..<a href="0" rel="nofollow">If you register your site for free at </a> =-.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: digioz</title>
		<link>http://www.hotscripts.com/blog/automatically-hyperlink-urls-and-e-mail-addresses-in-asp-net/comment-page-1/#comment-183</link>
		<dc:creator>digioz</dc:creator>
		<pubDate>Sat, 13 Mar 2010 15:14:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.hotscripts.com/blog/?p=759#comment-183</guid>
		<description>Actually, the code above is incorrect, because it doesn&#039;t grab the original URL and Email to include in the hyperlink (it just creates blank hyperlink).

Below is the corrected version of this code:

public string AutoParseURLAndEmail(string psText)
{
    string lsStrContent = psText;
    Regex loURLRegex = new Regex(@&quot;(http:\/\/([\w.]+\/?)\S*)&quot;, RegexOptions.IgnoreCase &#124; RegexOptions.Compiled);
    
    lsStrContent = loURLRegex.Replace(lsStrContent, &quot;&lt;a href=&quot;http://$2&quot; rel=&quot;nofollow&quot;&gt;http://$2&lt;/a&gt;&quot;);

    Regex loEmailRegex = new Regex(@&quot;([a-zA-Z_0-9.-]+\@[a-zA-Z_0-9.-]+\.\w+)&quot;, RegexOptions.IgnoreCase &#124; RegexOptions.Compiled);

    lsStrContent = loEmailRegex.Replace(lsStrContent, &quot;&lt;a href=&quot;mailto:$1&quot; rel=&quot;nofollow&quot;&gt;&lt;/a&gt;&quot;);
    return lsStrContent;
}</description>
		<content:encoded><![CDATA[<p>Actually, the code above is incorrect, because it doesn&#8217;t grab the original URL and Email to include in the hyperlink (it just creates blank hyperlink).</p>
<p>Below is the corrected version of this code:</p>
<p>public string AutoParseURLAndEmail(string psText)<br />
{<br />
    string lsStrContent = psText;<br />
    Regex loURLRegex = new Regex(@&#8221;(http:\/\/([\w.]+\/?)\S*)&#8221;, RegexOptions.IgnoreCase | RegexOptions.Compiled);</p>
<p>    lsStrContent = loURLRegex.Replace(lsStrContent, &#8220;<a href="http://$2" rel="nofollow">http://$2</a>&#8220;);</p>
<p>    Regex loEmailRegex = new Regex(@&#8221;([a-zA-Z_0-9.-]+\@[a-zA-Z_0-9.-]+\.\w+)&#8221;, RegexOptions.IgnoreCase | RegexOptions.Compiled);</p>
<p>    lsStrContent = loEmailRegex.Replace(lsStrContent, &#8220;<a href="mailto:$1" rel="nofollow"></a>&#8220;);<br />
    return lsStrContent;<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

