<?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: Utilizing Regular Expressions in AS3</title>
	<atom:link href="http://donttrustthisguy.com/2008/02/29/utilizing-regular-expressions-in-as3/feed/" rel="self" type="application/rss+xml" />
	<link>http://donttrustthisguy.com/2008/02/29/utilizing-regular-expressions-in-as3/</link>
	<description>Why not take my word for it?</description>
	<lastBuildDate>Thu, 11 Mar 2010 10:36:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: AS3 and the kids &#171; Max Blog</title>
		<link>http://donttrustthisguy.com/2008/02/29/utilizing-regular-expressions-in-as3/comment-page-1/#comment-6843</link>
		<dc:creator>AS3 and the kids &#171; Max Blog</dc:creator>
		<pubDate>Sat, 07 Nov 2009 22:49:17 +0000</pubDate>
		<guid isPermaLink="false">http://donttrustthisguy.com/2008/03/02/utilizing-regular-expressionsregex-in-as3/#comment-6843</guid>
		<description>[...] I posted a references to usage of E4X in previous post. And here is a reference for RegEx:http://donttrustthisguy.com/2008/02/29/utilizing-regular-expressions-in-as3/ [...]</description>
		<content:encoded><![CDATA[<p>[...] I posted a references to usage of E4X in previous post. And here is a reference for RegEx:http://donttrustthisguy.com/2008/02/29/utilizing-regular-expressions-in-as3/ [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nitesh</title>
		<link>http://donttrustthisguy.com/2008/02/29/utilizing-regular-expressions-in-as3/comment-page-1/#comment-6669</link>
		<dc:creator>Nitesh</dc:creator>
		<pubDate>Tue, 22 Sep 2009 06:17:11 +0000</pubDate>
		<guid isPermaLink="false">http://donttrustthisguy.com/2008/03/02/utilizing-regular-expressionsregex-in-as3/#comment-6669</guid>
		<description>private function pointToUser():String {  hi how to show visited link in different color</description>
		<content:encoded><![CDATA[<p>private function pointToUser():String {  hi how to show visited link in different color</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Germille</title>
		<link>http://donttrustthisguy.com/2008/02/29/utilizing-regular-expressions-in-as3/comment-page-1/#comment-6476</link>
		<dc:creator>Germille</dc:creator>
		<pubDate>Wed, 15 Jul 2009 12:57:48 +0000</pubDate>
		<guid isPermaLink="false">http://donttrustthisguy.com/2008/03/02/utilizing-regular-expressionsregex-in-as3/#comment-6476</guid>
		<description>_text = ” ” + _text + ” “;
_text = _text.replace(regUser, linkUser);
_text = _text.replace(regUrl, linkUrl);
_text = _text.substr(1, _text.length-2);Thank you guys, the code is awesome.</description>
		<content:encoded><![CDATA[<p>_text = ” ” + _text + ” “;<br />
_text = _text.replace(regUser, linkUser);<br />
_text = _text.replace(regUrl, linkUrl);<br />
_text = _text.substr(1, _text.length-2);Thank you guys, the code is awesome.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlodemarchis</title>
		<link>http://donttrustthisguy.com/2008/02/29/utilizing-regular-expressions-in-as3/comment-page-1/#comment-6340</link>
		<dc:creator>carlodemarchis</dc:creator>
		<pubDate>Tue, 16 Jun 2009 04:43:11 +0000</pubDate>
		<guid isPermaLink="false">http://donttrustthisguy.com/2008/03/02/utilizing-regular-expressionsregex-in-as3/#comment-6340</guid>
		<description>GEEZ! I love this post!It&#039;s 6.30am  I needed to write an exact same function and was in a hurry...So thanks from a sunny Torino in Italy!</description>
		<content:encoded><![CDATA[<p>GEEZ! I love this post!It&#8217;s 6.30am  I needed to write an exact same function and was in a hurry&#8230;So thanks from a sunny Torino in Italy!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://donttrustthisguy.com/2008/02/29/utilizing-regular-expressions-in-as3/comment-page-1/#comment-5300</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Thu, 11 Sep 2008 22:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://donttrustthisguy.com/2008/03/02/utilizing-regular-expressionsregex-in-as3/#comment-5300</guid>
		<description>Thanks for this post, Jim! I read it a while back and it just recently
came in handy. I made a few enhancements to what you have and figured
I would share the new code. It takes into consideration common usages
like:
@username:
@username-
(http//address)
[http//address]
http//address,
http//address.

Commas and periods can appear in URLs, so they are acceptable anywhere
in the URL except for at the end.

private function linkUser():String {
	return arguments[1].substr(0, 1) + &quot;&lt;a href=\&quot;http://twitter.com/&quot;
+ arguments[1].substr(2,arguments[1].length-3)+&quot;\&quot;&gt;&quot; +
arguments[1].substr(1,arguments[1].length-2) + &quot;&lt;/a&gt;&quot; +
arguments[1].substr(arguments[1].length-1,1);
}
private function linkUrl():String {
	return arguments[1]+&quot;&lt;a
href=\&quot;&quot;+arguments[2]+&quot;\&quot;&gt;&quot;+arguments[2]+&quot;&lt;/a&gt;&quot;;
}
var regUser:RegExp = /([\s&#124;\(&#124;\[]@+\w*(\s&#124;,&#124;!&#124;\.&#124;\n&#124;\)&#124;\]&#124;\-&#124;\:))/g;
var regUrl:RegExp =
/([^&quot;&#124;^&gt;])(http:\/\/+[a-zA-Z0-9\.\-\/_+=%&amp;\?\,]*[a-zA-Z0-9\-\/_+=%&amp;\?])/g;
var _text:String = &quot;@jimjeffers: I (@brianshaler) like
http://donttrustthisguy.com/, and think it
(http://donttrustthisguy.com) is great!&quot;;
_text = &quot; &quot; + _text + &quot; &quot;;
_text = _text.replace(regUser, linkUser);
_text = _text.replace(regUrl, linkUrl);
_text = _text.substr(1, _text.length-2);
trace(_text);
// &lt;a href=&quot;http://twitter.com/jimjeffers&quot;&gt;@jimjeffers&lt;/a&gt;:
I (&lt;a href=&quot;http://twitter.com/brianshaler&quot;&gt;@brianshaler&lt;/a&gt;)
like &lt;a href=&quot;http://donttrustthisguy.com/&quot;&gt;http://donttrustthisguy.com/&lt;/a&gt;,
and think it (&lt;a
href=&quot;http://donttrustthisguy.com&quot;&gt;http://donttrustthisguy.com&lt;/a&gt;)
is great!</description>
		<content:encoded><![CDATA[<p>Thanks for this post, Jim! I read it a while back and it just recently<br />
came in handy. I made a few enhancements to what you have and figured<br />
I would share the new code. It takes into consideration common usages<br />
like:<br />
@username:<br />
@username-<br />
(http//address)<br />
[http//address]<br />
http//address,<br />
http//address.</p>
<p>Commas and periods can appear in URLs, so they are acceptable anywhere<br />
in the URL except for at the end.</p>
<p>private function linkUser():String {<br />
	return arguments[1].substr(0, 1) + &#8220;&lt;a href=\&#8221;http://twitter.com/&#8221;<br />
+ arguments[1].substr(2,arguments[1].length-3)+&#8221;\&#8221;&gt;&#8221; +<br />
arguments[1].substr(1,arguments[1].length-2) + &#8220;&lt;/a&gt;&#8221; +<br />
arguments[1].substr(arguments[1].length-1,1);<br />
}<br />
private function linkUrl():String {<br />
	return arguments[1]+&#8221;&lt;a<br />
href=\&#8221;"+arguments[2]+&#8221;\&#8221;&gt;&#8221;+arguments[2]+&#8221;&lt;/a&gt;&#8221;;<br />
}<br />
var regUser:RegExp = /([\s|\(|\[]@+\w*(\s|,|!|\.|\n|\)|\]|\-|\:))/g;<br />
var regUrl:RegExp =<br />
/([^"|^&gt;])(http:\/\/+[a-zA-Z0-9\.\-\/_+=%&amp;\?\,]*[a-zA-Z0-9\-\/_+=%&amp;\?])/g;<br />
var _text:String = &#8220;@jimjeffers: I (@brianshaler) like<br />
<a href="http://donttrustthisguy.com/" rel="nofollow">http://donttrustthisguy.com/</a>, and think it<br />
(<a href="http://donttrustthisguy.com" rel="nofollow">http://donttrustthisguy.com</a>) is great!&#8221;;<br />
_text = &#8221; &#8221; + _text + &#8221; &#8220;;<br />
_text = _text.replace(regUser, linkUser);<br />
_text = _text.replace(regUrl, linkUrl);<br />
_text = _text.substr(1, _text.length-2);<br />
trace(_text);<br />
// &lt;a href=&#8221;http://twitter.com/jimjeffers&#8221;&gt;@jimjeffers&lt;/a&gt;:<br />
I (&lt;a href=&#8221;http://twitter.com/brianshaler&#8221;&gt;@brianshaler&lt;/a&gt;)<br />
like &lt;a href=&#8221;http://donttrustthisguy.com/&#8221;&gt;http://donttrustthisguy.com/&lt;/a&gt;,<br />
and think it (&lt;a<br />
href=&#8221;http://donttrustthisguy.com&#8221;&gt;http://donttrustthisguy.com&lt;/a&gt;)<br />
is great!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eduard</title>
		<link>http://donttrustthisguy.com/2008/02/29/utilizing-regular-expressions-in-as3/comment-page-1/#comment-5183</link>
		<dc:creator>Eduard</dc:creator>
		<pubDate>Wed, 04 Jun 2008 17:01:32 +0000</pubDate>
		<guid isPermaLink="false">http://donttrustthisguy.com/2008/03/02/utilizing-regular-expressionsregex-in-as3/#comment-5183</guid>
		<description>Hi Jim,

Thank you so much about this post. It was really helpful to understand the use of regular expressions in AS3, plus you hinted me to a wonderful OS X app for previewing RegExps! :)

About the optimization of your loop, it might be solved just by adding the Global flag in your regular expression at the very end: /g For instance, in your example, var url:RegExp = /[^&quot;&#124;^&gt;](http:\/\/+[\S]*)/g;

This will automatically &quot;do the loop&quot; for you and replace all instances at once.

All the best,
Eduard</description>
		<content:encoded><![CDATA[<p>Hi Jim,</p>
<p>Thank you so much about this post. It was really helpful to understand the use of regular expressions in AS3, plus you hinted me to a wonderful OS X app for previewing RegExps! <img src='http://donttrustthisguy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>About the optimization of your loop, it might be solved just by adding the Global flag in your regular expression at the very end: /g For instance, in your example, var url:RegExp = /[^"|^&gt;](http:\/\/+[\S]*)/g;</p>
<p>This will automatically &#8220;do the loop&#8221; for you and replace all instances at once.</p>
<p>All the best,<br />
Eduard</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joshspoon</title>
		<link>http://donttrustthisguy.com/2008/02/29/utilizing-regular-expressions-in-as3/comment-page-1/#comment-5071</link>
		<dc:creator>joshspoon</dc:creator>
		<pubDate>Fri, 21 Mar 2008 04:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://donttrustthisguy.com/2008/03/02/utilizing-regular-expressionsregex-in-as3/#comment-5071</guid>
		<description>thanks. I didn&#039;t notice for some reason this was is displaying one at a time and was on a timer. That&#039;s why it didn&#039;t work the way I wanted it. 

I&#039;m needing it to loop thur an array of objects and parse each one with their respective links. So I really don&#039;t know RegEx to change what you have and I don&#039;t understand you if statement for the @. So I guess I&#039;ll just keep the hack I have and strip out the wierd null I get. It works other than that.</description>
		<content:encoded><![CDATA[<p>thanks. I didn&#8217;t notice for some reason this was is displaying one at a time and was on a timer. That&#8217;s why it didn&#8217;t work the way I wanted it. </p>
<p>I&#8217;m needing it to loop thur an array of objects and parse each one with their respective links. So I really don&#8217;t know RegEx to change what you have and I don&#8217;t understand you if statement for the @. So I guess I&#8217;ll just keep the hack I have and strip out the wierd null I get. It works other than that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joshspoon</title>
		<link>http://donttrustthisguy.com/2008/02/29/utilizing-regular-expressions-in-as3/comment-page-1/#comment-5067</link>
		<dc:creator>joshspoon</dc:creator>
		<pubDate>Thu, 20 Mar 2008 18:44:58 +0000</pubDate>
		<guid isPermaLink="false">http://donttrustthisguy.com/2008/03/02/utilizing-regular-expressionsregex-in-as3/#comment-5067</guid>
		<description>http://donttrustthisguy.com/rssdropper.zip

is a 404.</description>
		<content:encoded><![CDATA[<p><a href="http://donttrustthisguy.com/rssdropper.zip" rel="nofollow">http://donttrustthisguy.com/rssdropper.zip</a></p>
<p>is a 404.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Jeffers</title>
		<link>http://donttrustthisguy.com/2008/02/29/utilizing-regular-expressions-in-as3/comment-page-1/#comment-5066</link>
		<dc:creator>Jim Jeffers</dc:creator>
		<pubDate>Wed, 19 Mar 2008 23:37:09 +0000</pubDate>
		<guid isPermaLink="false">http://donttrustthisguy.com/2008/03/02/utilizing-regular-expressionsregex-in-as3/#comment-5066</guid>
		<description>Hey Josh,

Check out my code in the actual source for the feed reader I built:

&lt;a href=&quot;http://donttrustthisguy.com/rssdropper.zip&quot; rel=&quot;nofollow&quot;&gt;RSS Dropper&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Hey Josh,</p>
<p>Check out my code in the actual source for the feed reader I built:</p>
<p><a href="http://donttrustthisguy.com/rssdropper.zip" rel="nofollow">RSS Dropper</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joshspoon</title>
		<link>http://donttrustthisguy.com/2008/02/29/utilizing-regular-expressions-in-as3/comment-page-1/#comment-5065</link>
		<dc:creator>joshspoon</dc:creator>
		<pubDate>Wed, 19 Mar 2008 03:44:08 +0000</pubDate>
		<guid isPermaLink="false">http://donttrustthisguy.com/2008/03/02/utilizing-regular-expressionsregex-in-as3/#comment-5065</guid>
		<description>I did change mine to reflect what you talked about.

The only problem is I get a null before my string that the function makes

here is the code:

private function dropRSS():void {
			//var cur:String = &quot;Hey @sunnythaper, @shalerjump, @jamesarcher! Check this out: http://tinyurl.com/377owu&quot;

			var cur:String = _statusText;
			if (cur.substr(0,1) == &quot;@&quot;) { 			// Skip response messages as they do not always provide enough context to be stand alone statements.
				trace(&quot;stall&quot;);
				_current++;
				dropRSS();
			} else {
				cur = cur+&quot; &quot;; // Append a space at the end so RegEx catches trailing expressions
		
				var twitterUser:RegExp = /(\s@+\w*(\s&#124;,&#124;!&#124;\.&#124;\n))/;		// &quot;
				var url:RegExp = /[^&quot;&#124;^&gt;](http:\/\/+[\S]*)/;
		
				while(twitterUser.exec (cur) != null) {
					cur = cur.replace(twitterUser, pointToUser);
				}
		
				while(url.exec (cur) != null) {
					cur = cur.replace(url, setUrl);
					
				}
				cur = cur.replace(/null/,&quot;&quot;);
				output.htmlText += cur + &quot;\n&quot;;
				
				_current++;
			}
		}</description>
		<content:encoded><![CDATA[<p>I did change mine to reflect what you talked about.</p>
<p>The only problem is I get a null before my string that the function makes</p>
<p>here is the code:</p>
<p>private function dropRSS():void {<br />
			//var cur:String = &#8220;Hey @sunnythaper, @shalerjump, @jamesarcher! Check this out: <a href="http://tinyurl.com/377owu" rel="nofollow">http://tinyurl.com/377owu</a>&#8221;</p>
<p>			var cur:String = _statusText;<br />
			if (cur.substr(0,1) == &#8220;@&#8221;) { 			// Skip response messages as they do not always provide enough context to be stand alone statements.<br />
				trace(&#8220;stall&#8221;);<br />
				_current++;<br />
				dropRSS();<br />
			} else {<br />
				cur = cur+&#8221; &#8220;; // Append a space at the end so RegEx catches trailing expressions</p>
<p>				var twitterUser:RegExp = /(\s@+\w*(\s|,|!|\.|\n))/;		// &#8221;<br />
				var url:RegExp = /[^"|^&gt;](http:\/\/+[\S]*)/;</p>
<p>				while(twitterUser.exec (cur) != null) {<br />
					cur = cur.replace(twitterUser, pointToUser);<br />
				}</p>
<p>				while(url.exec (cur) != null) {<br />
					cur = cur.replace(url, setUrl);</p>
<p>				}<br />
				cur = cur.replace(/null/,&#8221;");<br />
				output.htmlText += cur + &#8220;\n&#8221;;</p>
<p>				_current++;<br />
			}<br />
		}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
