<?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: Parsing Twitter with RegExp</title>
	<atom:link href="http://saturnboy.com/2010/02/parsing-twitter-with-regexp/feed/" rel="self" type="application/rss+xml" />
	<link>http://saturnboy.com/2010/02/parsing-twitter-with-regexp/</link>
	<description>Code, Work, and Life</description>
	<lastBuildDate>Mon, 23 Jan 2012 16:21:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Julien Henrotte</title>
		<link>http://saturnboy.com/2010/02/parsing-twitter-with-regexp/comment-page-1/#comment-373</link>
		<dc:creator>Julien Henrotte</dc:creator>
		<pubDate>Mon, 12 Dec 2011 20:19:41 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=1055#comment-373</guid>
		<description>Begin with 

&lt;pre lang=&quot;php&quot;&gt;
$stringText = preg_replace(&#039;@(https?://([-\w\.]+)+(/([\w/_\.]*(\?\S+)?(#\S+)?)?)?)@&#039;, &#039;&lt;a href=&quot;$1&quot; rel=&quot;nofollow&quot;&gt;$1&lt;/a&gt;&#039;, $stringText);
$stringText = preg_replace(&#039;/@(\w+)/&#039;, &#039;&lt;a href=&quot;http://twitter.com/$1&quot; rel=&quot;nofollow&quot;&gt;@$1&lt;/a&gt;&#039;, $stringText);
$stringText = preg_replace(&#039;/\#(\w+)/&#039;, &#039; &lt;a href=&quot;http://search.twitter.com/search?q=%23$1&quot; rel=&quot;nofollow&quot;&gt;#$1&lt;/a&gt;&#039;, $stringText);
&lt;/pre&gt;

Because if you have an &lt;code&gt;#hashtag&lt;/code&gt; at the beginning...</description>
		<content:encoded><![CDATA[<p>Begin with</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$stringText</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'@(https?://([-\w\.]+)+(/([\w/_\.]*(\?\S+)?(#\S+)?)?)?)@'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;a href=&quot;$1&quot; rel=&quot;nofollow&quot;&gt;$1&lt;/a&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$stringText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$stringText</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/@(\w+)/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;a href=&quot;http://twitter.com/$1&quot; rel=&quot;nofollow&quot;&gt;@$1&lt;/a&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$stringText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$stringText</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/\#(\w+)/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">' &lt;a href=&quot;http://search.twitter.com/search?q=%23$1&quot; rel=&quot;nofollow&quot;&gt;#$1&lt;/a&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$stringText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Because if you have an <code>#hashtag</code> at the beginning&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Webdev</title>
		<link>http://saturnboy.com/2010/02/parsing-twitter-with-regexp/comment-page-1/#comment-360</link>
		<dc:creator>Webdev</dc:creator>
		<pubDate>Thu, 24 Nov 2011 01:01:53 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=1055#comment-360</guid>
		<description>Thanks for your tutorial, I am trying to do the same but using jQuery. Does anybody know how to parse Twitter text using jQuery with href element.</description>
		<content:encoded><![CDATA[<p>Thanks for your tutorial, I am trying to do the same but using jQuery. Does anybody know how to parse Twitter text using jQuery with href element.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maysala</title>
		<link>http://saturnboy.com/2010/02/parsing-twitter-with-regexp/comment-page-1/#comment-322</link>
		<dc:creator>maysala</dc:creator>
		<pubDate>Fri, 02 Sep 2011 08:00:56 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=1055#comment-322</guid>
		<description>Your hashtag regexp doesn&#039;t match characteres that are not english.</description>
		<content:encoded><![CDATA[<p>Your hashtag regexp doesn&#8217;t match characteres that are not english.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: argenisleon</title>
		<link>http://saturnboy.com/2010/02/parsing-twitter-with-regexp/comment-page-1/#comment-264</link>
		<dc:creator>argenisleon</dc:creator>
		<pubDate>Sat, 12 Mar 2011 03:12:48 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=1055#comment-264</guid>
		<description>Works perfect :D Thanks!</description>
		<content:encoded><![CDATA[<p>Works perfect <img src='http://saturnboy.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: justin</title>
		<link>http://saturnboy.com/2010/02/parsing-twitter-with-regexp/comment-page-1/#comment-263</link>
		<dc:creator>justin</dc:creator>
		<pubDate>Sat, 12 Mar 2011 02:28:17 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=1055#comment-263</guid>
		<description>@argenisleon: A little weird to find emails in tweets, but you can adjust the user regexp like this:

&lt;pre lang=&quot;php&quot;&gt;
$text = preg_replace(&#039;/^@(\w+)/&#039;, &#039;&lt;a href=&quot;http://twitter.com/$1&quot; rel=&quot;nofollow&quot;&gt;@$1&lt;/a&gt;&#039;, $text);
$text = preg_replace(&#039;/ @(\w+)/&#039;, &#039; &lt;a href=&quot;http://twitter.com/$1&quot; rel=&quot;nofollow&quot;&gt;@$1&lt;/a&gt;&#039;, $text);
&lt;/pre&gt;

The first one get&#039;s all your retweets and such that begin with &lt;code&gt;@&lt;/code&gt;, and the second one gets only those with a space then an &lt;code&gt;@&lt;/code&gt;.  This will skip any email addresses.</description>
		<content:encoded><![CDATA[<p>@argenisleon: A little weird to find emails in tweets, but you can adjust the user regexp like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/^@(\w+)/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;a href=&quot;http://twitter.com/$1&quot; rel=&quot;nofollow&quot;&gt;@$1&lt;/a&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/ @(\w+)/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">' &lt;a href=&quot;http://twitter.com/$1&quot; rel=&quot;nofollow&quot;&gt;@$1&lt;/a&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The first one get&#8217;s all your retweets and such that begin with <code>@</code>, and the second one gets only those with a space then an <code>@</code>.  This will skip any email addresses.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: argenisleon</title>
		<link>http://saturnboy.com/2010/02/parsing-twitter-with-regexp/comment-page-1/#comment-262</link>
		<dc:creator>argenisleon</dc:creator>
		<pubDate>Sat, 12 Mar 2011 00:02:07 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=1055#comment-262</guid>
		<description>Amazing code. I have a little proble when parsing email. For example &lt;code&gt;hello&#064;hello.com&lt;/code&gt;, only the &lt;code&gt;&#064;hello.com&lt;/code&gt; part is parsed as a link. Any help?</description>
		<content:encoded><![CDATA[<p>Amazing code. I have a little proble when parsing email. For example <code>hello&#64;hello.com</code>, only the <code>&#64;hello.com</code> part is parsed as a link. Any help?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: justin</title>
		<link>http://saturnboy.com/2010/02/parsing-twitter-with-regexp/comment-page-1/#comment-246</link>
		<dc:creator>justin</dc:creator>
		<pubDate>Wed, 05 Jan 2011 17:08:56 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=1055#comment-246</guid>
		<description>@Sony AK:  If you are worried about that particular case, just add a forth regexp like this:

&lt;pre lang=&quot;php&quot;&gt;
$text = preg_replace(&#039;/^#(\w+)/&#039;, &#039;&lt;a href=&quot;http://search.twitter.com/search?q=%23$1&quot; rel=&quot;nofollow&quot;&gt;#$1&lt;/a&gt;&#039;, $text);
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Sony AK:  If you are worried about that particular case, just add a forth regexp like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/^#(\w+)/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;a href=&quot;http://search.twitter.com/search?q=%23$1&quot; rel=&quot;nofollow&quot;&gt;#$1&lt;/a&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Sony AK</title>
		<link>http://saturnboy.com/2010/02/parsing-twitter-with-regexp/comment-page-1/#comment-245</link>
		<dc:creator>Sony AK</dc:creator>
		<pubDate>Tue, 04 Jan 2011 16:47:41 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=1055#comment-245</guid>
		<description>for the hashtag parsing, if I put the hashtag in the very front of string e.g. &#039;#mychannel bla bla bla&#039; it will not parse properly.</description>
		<content:encoded><![CDATA[<p>for the hashtag parsing, if I put the hashtag in the very front of string e.g. &#8216;#mychannel bla bla bla&#8217; it will not parse properly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Curran</title>
		<link>http://saturnboy.com/2010/02/parsing-twitter-with-regexp/comment-page-1/#comment-214</link>
		<dc:creator>Curran</dc:creator>
		<pubDate>Wed, 24 Nov 2010 18:11:03 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=1055#comment-214</guid>
		<description>Thanks Justin! Killer code!</description>
		<content:encoded><![CDATA[<p>Thanks Justin! Killer code!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: justin</title>
		<link>http://saturnboy.com/2010/02/parsing-twitter-with-regexp/comment-page-1/#comment-156</link>
		<dc:creator>justin</dc:creator>
		<pubDate>Thu, 08 Jul 2010 20:17:47 +0000</pubDate>
		<guid isPermaLink="false">http://saturnboy.com/?p=1055#comment-156</guid>
		<description>@Austin: Sounds like your server is super lame.  Maybe you should ask for an upgrade?  Good luck.</description>
		<content:encoded><![CDATA[<p>@Austin: Sounds like your server is super lame.  Maybe you should ask for an upgrade?  Good luck.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

