title: How to parse street address with Regex?
body: <p>I am working on a regex to parse full addresses by street number, street name, city, state, and zip code.</p>
  
  <p>I came up with a pretty good regex that works for most cases, however, there are a couple scenarios where it fails. I need help with improving it. Here is what I have currently</p>
  
  <pre><code>Pattern pattern = Pattern.compile("^([\\d-]{0,}[\\s-]{0,}[\\d/]+)[\\s]{0,}");
  </code></pre>
  
  <p>This works fine if the street addresses are formed nicely where the address starts with a street number that has no letters attached to it. For example :</p>
  
  <ul>
  <li><code>123 Street Address, CA, 55555</code> <strong>works fine</strong>. </li>
  <li><p>However <code>123 4th Street Address, CA, 55555</code> will result in :</p>
  
  <pre><code>  1234 =&gt; street number
    th Street =&gt; street name
  </code></pre></li>
  </ul>
  
  <p>I have done a lot of research on parsing addresses and this solution I have come up with is just about the simplest solution I've found. Just need a little more tweaks. Thanks in advance.</p>