<?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; regular expressions</title>
	<atom:link href="http://adamloving.com/tag/regular-expressions/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>
	</channel>
</rss>
