<?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>Matt J. Wilson &#187; RegEx</title>
	<atom:link href="http://www.mattjwilson.com/blog/tag/regex/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mattjwilson.com/blog</link>
	<description>General ramblings, programming frustrations, and complete randomness.  Have questions? E-mail me.</description>
	<lastBuildDate>Tue, 19 Jan 2010 19:37:48 +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>Address Pattern Regular Expression</title>
		<link>http://www.mattjwilson.com/blog/2009/07/14/address-pattern-regular-expression/</link>
		<comments>http://www.mattjwilson.com/blog/2009/07/14/address-pattern-regular-expression/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 17:28:12 +0000</pubDate>
		<dc:creator>Matt J. Wilson</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[RegEx]]></category>

		<guid isPermaLink="false">http://www.mattjwilson.com/blog/?p=38</guid>
		<description><![CDATA[So I searched the internet for quite a while to find a street address regex that actually worked (and worked well).  I didn&#8217;t manage to accomplish this, so I wrote my own.  I&#8217;m keeping the address extraction algorithms and logic private, but I figured I could at least share the first part of the Regex:
Regex [...]]]></description>
			<content:encoded><![CDATA[<p>So I searched the internet for quite a while to find a street address regex that actually worked (and worked well).  I didn&#8217;t manage to accomplish this, so I wrote my own.  I&#8217;m keeping the address extraction algorithms and logic private, but I figured I could at least share the first part of the Regex:</p>
<p>Regex addressPattern = new Regex(@&quot;(?&lt;city&gt;[A-Za-z',.\s]+) (?&lt;state&gt;([A-Za-z]{2}|[A-Za-z]{2},))\s*(?&lt;zip&gt;\d{5}(-\d{4})|\d{5})&quot;);</p>
<p>MatchCollection matches = addressPattern.Matches(text);</p>
<p>for (int mc = 0; mc &lt; matches.Count; mc++)<br />
{<br />
string city =  matches[mc].Groups[&quot;city&quot;].Value;<br />
string state =  matches[mc].Groups[&quot;state&quot;].Value;<br />
string zip =  matches[mc].Groups[&quot;zip&quot;].Value;<br />
}</p>
<p>[/c-sharp]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjwilson.com/blog/2009/07/14/address-pattern-regular-expression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

