<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post//</link>
<title><![CDATA[[转]JavaScript实现http地址自动检测并添加URL链接]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Fri, 13 Sep 2013 08:11:26 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	背景：写一个简单的聊天系统，发出Htpp的Url实现跳转加上a标签。<br/>实现代码：<br/><textarea name="code" class="JS" rows="15" cols="100">
String.prototype.httpHtml = function()&#123;
&nbsp;&nbsp;var reg = /(http:&#92;/&#92;/&#124;https:&#92;/&#92;/)((&#92;w&#124;=&#124;&#92;?&#124;&#92;.&#124;&#92;/&#124;&amp;&#124;-)+)/g;
&nbsp;&nbsp;return this.replace(reg, &#039;&lt;a target=_blank href=&quot;$1$2&quot;&gt;$1$2&lt;/a&gt;&#039;);
&#125;;
</textarea><br/><br/>来自：http://www.zhangxinxu.com/wordpress/?p=749<br/><br/>摘录：<br/>URL地址自动添加的实现<br/>URL地址自动添加的实现其实就是那么点内容：检测与替换。<br/>检测<br/>“检测”就是检测文字（字符串）内部是否有符合http地址的内容，显然，这需要用到正则表达式进行验证，这个工作前端和后台都可以做，这里，只讲前端的方法，使用JavaScript实现。<br/>验证HTTP地址的正则表达式如下（可能有疏漏或是不准确之处，欢迎指正）：<br/>var reg = /(http:&#92;/&#92;/&#124;https:&#92;/&#92;/)((&#92;w&#124;=&#124;&#92;?&#124;&#92;.&#124;&#92;/&#124;&amp;&#124;-)+)/g;<br/>前一部分匹配http或是https开头的URL字符串地址，后面一部分匹配一些字符，英文字符、下划线(_)、点号(.)、问号(?)以及等号(=)，连接短线(-)等。<br/>替换<br/>说到JavaScript中的替换功能，首先想到的自然是replace属性了，replace属性强大之处在于其支持正则表达式，可以对符合正则的字符串进行替换。例如，我们要替换掉字符串两端的空格就可以使用类似下面的语句：<br/>var s = &quot; blank &quot;;<br/>s = s.replace(/^&#92;s+(.*?)&#92;s+$/, &quot;&quot;);<br/>alert(s);
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [转]JavaScript实现http地址自动检测并添加URL链接]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>