How to extract address with regular expressions
<p>I have a document where there's an address, but at the beginning there's a date. I want a regex to extract the address because I'm getting just the date.</p>

<p>The format of the address</p>

<ul>
<li>1 to 5 numbers then </li>
<li>space then </li>
<li>consecutive words but no digits then</li>
<li>space or comma then</li>
<li>word then</li>
<li>space or comma then</li>
<li>2 uppercase letters (finish at these two letters)</li>
</ul>

<p>i.e. </p>

<ul>
<li>5664 rue pierre labelle montreal QC</li>
<li>5456 avenue martin curé, sherbrooke, QC</li>
</ul>

<p>I tried this but I get nothing. I played more than a couple of hours, but I get sometimes the date of the document which is before the address and then 2 words at the beginning of the paragraph.</p>

<pre><code>  "\\d{1,5}\\s(\\b\\w+\\b){1,2}\\w*\\s?,?\\w*\\s?,?\\w*\\s?,?[A-ZA-Z]"
</code></pre>

<p>This is part of the text</p>

<blockquote>
  <p>23 July 2016</p>
  
  <p>George Washington living at 5664 rue pierre labelle montreal QC G1H
  3A4. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</blockquote>

<p>Another document</p>

<blockquote>
  <p>05 January 2016</p>
  
  <p>Juana Perez living at 5456 avenue martin curé, sherbrooke, QC, 
  G1H 3A8. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</blockquote>

<p>Another document</p>

<pre><code>Salvador Dali living at

5 Ch Ste-Catherine 
Montreal QC 
J2S 8W3 
</code></pre>