<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Adam Loving's Blog &#187; ruby</title>
	<atom:link href="http://adamloving.com/tag/ruby/feed" rel="self" type="application/rss+xml" />
	<link>http://adamloving.com</link>
	<description>Seattle Social Web Development</description>
	<lastBuildDate>Sat, 09 Jan 2010 21:24:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Common Ruby Regex Patterns</title>
		<link>http://adamloving.com/internet-programming/common-ruby-regex-patterns</link>
		<comments>http://adamloving.com/internet-programming/common-ruby-regex-patterns#comments</comments>
		<pubDate>Sun, 27 Jul 2008 16:39:26 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Projects, Programming, Technology]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://adamloving.com/?p=427</guid>
		<description><![CDATA[My earlier (rather lame) post on Ruby Regex&#8217;s (Regular Expressions) is getting some Google love, so I thought I would supplement it with some more useful information.
If you are searching for Ruby Regex help, my guess is you are looking for&#8230;
Validating an email address with a Ruby Regex
Something simple like this next one will get [...]]]></description>
			<content:encoded><![CDATA[<p>My earlier (rather lame) post on <a href="http://adamloving.com/2008/01/07/ruby-quickref-2/">Ruby Regex&#8217;s (Regular Expressions)</a> is getting some Google love, so I thought I would supplement it with some more useful information.</p>
<p>If you are searching for Ruby Regex help, my guess is you are looking for&#8230;</p>
<h3>Validating an email address with a Ruby Regex</h3>
<p>Something simple like this next one will get you started.</p>
<p>irb(main):023:0&gt; &#8220;me@adamloving.com&#8221;.match /^([^@s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})$/i</p>
<p>For a much more complete <a href="http://tfletcher.com/lib/rfc822.rb">email address ruby regex</a>, try:</p>
<pre>#
# RFC822 Email Address Regex
# --------------------------
#
# Originally written by Cal Henderson
# c.f. http://iamcal.com/publish/articles/php/parsing_email/
#
# Translated to Ruby by Tim Fletcher, with changes suggested by Dan Kubb.
#
# Licensed under a Creative Commons Attribution-ShareAlike 2.5 License
# http://creativecommons.org/licenses/by-sa/2.5/
#
module RFC822
  EmailAddress = begin
    qtext = '[^\x0d\x22\x5c\x80-\xff]'
    dtext = '[^\x0d\x5b-\x5d\x80-\xff]'
    atom = '[^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-' +
      '\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+'
    quoted_pair = '\x5c[\x00-\x7f]'
    domain_literal = "\x5b(?:#{dtext}|#{quoted_pair})*\x5d"
    quoted_string = "\x22(?:#{qtext}|#{quoted_pair})*\x22"
    domain_ref = atom
    sub_domain = "(?:#{domain_ref}|#{domain_literal})"
    word = "(?:#{atom}|#{quoted_string})"
    domain = "#{sub_domain}(?:\x2e#{sub_domain})*"
    local_part = "#{word}(?:\x2e#{word})*"
    addr_spec = "#{local_part}\x40#{domain}"
    pattern = /A#{addr_spec}z/
  end
end</pre>
<h3>Find URLs using a Regular Expression in Ruby</h3>
<p>Here is a simple URL matching regular expression.</p>
<pre>irb(main):028:0&gt; "http://www.adamloving.com/".match /^(http|https)://[a-z0-9]+([-.]{1}[a-z0-9]+)*.[a-z]{2,5}(([0-9]{1,5})?/.*)?$/ix</pre>
]]></content:encoded>
			<wfw:commentRss>http://adamloving.com/internet-programming/common-ruby-regex-patterns/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby boolean operator (or ruby parsing) bug</title>
		<link>http://adamloving.com/internet-programming/ruby-boolean-operator-or-ruby-parsing-bug</link>
		<comments>http://adamloving.com/internet-programming/ruby-boolean-operator-or-ruby-parsing-bug#comments</comments>
		<pubDate>Wed, 09 Jul 2008 22:33:39 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Projects, Programming, Technology]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://adamloving.com/?p=399</guid>
		<description><![CDATA[This has bitten me a couple times in the last few days. The Ruby &#8220;or&#8221; (or equals) operator appears to have a bug where, when used in an assignment, the first value is assigned rather than the results of the entire expression.
irb(main):001:0&#62; x = false &#124;&#124; true
=&#62; true
irb(main):002:0&#62; x
=&#62; true
irb(main):003:0&#62; z = false or true
=&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>This has bitten me a couple times in the last few days. The Ruby &#8220;or&#8221; (or equals) operator appears to have a bug where, when used in an assignment, the first value is assigned rather than the results of the entire expression.</p>
<p>irb(main):001:0&gt; x = false || true<br />
=&gt; true<br />
irb(main):002:0&gt; x<br />
=&gt; true<br />
irb(main):003:0&gt; z = false or true<br />
=&gt; true<br />
irb(main):004:0&gt; z<br />
=&gt; <strong>false</strong></p>
<p>ruby version: ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.10.1]</p>
<p>I would expect z to be true in that last example.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/a23916fc-a6d1-4a9c-9e5d-806cbfccece6/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=a23916fc-a6d1-4a9c-9e5d-806cbfccece6" alt="Zemanta Pixie" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://adamloving.com/internet-programming/ruby-boolean-operator-or-ruby-parsing-bug/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Translating c# to Ruby, Python, Java and Javascript</title>
		<link>http://adamloving.com/internet-programming/converting-c-sharp-to-ruby-python-javascript-java</link>
		<comments>http://adamloving.com/internet-programming/converting-c-sharp-to-ruby-python-javascript-java#comments</comments>
		<pubDate>Sat, 21 Jun 2008 20:36:16 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Projects, Programming, Technology]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://adamloving.com/?p=303</guid>
		<description><![CDATA[I created a Google spreadsheet to help me learn common phrases in Ruby and Python. This is an overly-ambitious project that I&#8217;ll probably never finish (I&#8217;ll have the function names learned faster than I update the spreadsheet). Anyone out there want to help? Add a comment below and I&#8217;ll ad you as a contributor to [...]]]></description>
			<content:encoded><![CDATA[<p>I created a Google spreadsheet to help me learn common phrases in Ruby and Python. This is an overly-ambitious project that I&#8217;ll probably never finish (I&#8217;ll have the function names learned faster than I update the spreadsheet). Anyone out there want to help? Add a comment below and I&#8217;ll ad you as a contributor to the spreadsheet.</p>
<p><iframe width='100%' height='500' frameborder='0' src='http://spreadsheets.google.com/pub?key=pFhDE8I0f33-GX0_GRCaXcg&#038;output=html&#038;widget=true'></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://adamloving.com/internet-programming/converting-c-sharp-to-ruby-python-javascript-java/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Ruby Regex Guide</title>
		<link>http://adamloving.com/internet-programming/ruby-quickref-2</link>
		<comments>http://adamloving.com/internet-programming/ruby-quickref-2#comments</comments>
		<pubDate>Mon, 07 Jan 2008 23:01:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Projects, Programming, Technology]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby regex]]></category>

		<guid isPermaLink="false">tag:google.com,2005:reader/item/d39f72b2303a6960</guid>
		<description><![CDATA[<p>with good regex help</p>
    <span>
        <a href="http://del.icio.us/post?url=http%3A%2F%2Fwww.zenspider.com%2FLanguages%2FRuby%2FQuickRef.html%2311&#38;title=Ruby%20QuickRef&#38;copyuser=adamloving&#38;copytags=ruby%2Breference&#38;jump=yes&#38;partner=delrss&#38;src=feed_google" rel="nofollow" title="add this bookmark to your collection at del.icio.us"><img src="http://images.del.icio.us/static/img/delicious.small.gif" alt="del.icio.us" width="10" height="10" border="0"> bookmark this on del.icio.us</a>
        -
        posted 
        by <a title="visit adamloving&#39;s bookmarks at del.icio.us" href="http://del.icio.us/adamloving">adamloving</a>
        to
            <a rel="tag" title="view adamloving&#39;s bookmarks tagged &#39;ruby&#39; at del.icio.us" href="http://del.icio.us/adamloving/ruby">ruby</a>
            <a rel="tag" title="view adamloving&#39;s bookmarks tagged &#39;reference&#39; at del.icio.us" href="http://del.icio.us/adamloving/reference">reference</a>
            - <a rel="self" title="view more details on this bookmark at del.icio.us" href="http://del.icio.us/url/618109300ff217b2ed8c2b1c1ca3e0eb">more about this bookmark...</a>
    </span>]]></description>
			<content:encoded><![CDATA[<p>Regular expressions are powerful, I&#8217;ve never really mastered them. Here is an excellent page with help on <a href="http://www.zenspider.com/Languages/Ruby/QuickRef.html#11">using ruby regular expressions</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://adamloving.com/internet-programming/ruby-quickref-2/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
