title: Regex python wont work as I want it
body: <p>I'm trying to filter street names and get the parts that I want. The names come in several formats. Here are some examples and what I want from them.</p>
  
  <pre class="lang-none prettyprint-override"><code>Car Cycle 5 B Ap 1233       &lt; what I have
  Car Cycle 5 B               &lt; what I want
  
  Potato street 13 1 AB       &lt; what I have
  Potato street 13            &lt; what I want
  
  Chrome Safari 41 Ap 765     &lt; what I have
  Chrome Safari 41            &lt; what I want
  
  Highstreet 53 Ap 2632/BH    &lt; what I have
  Highstreet 53               &lt; what I want
  
  Something street 91/Daniel  &lt; what I have
  Something street 91           &lt; what I want
  </code></pre>
  
  <p>Usually what I want is the street name (1-4 names) followed by the street number if there is one and then the street letter (1 letter) if there is one. I just can't get it to work right. </p>
  
  <p>Here is my code (I know, it sucks): </p>
  
  <pre class="lang-py prettyprint-override"><code>import re
  
  def address_regex(address):
      regex1 = re.compile("(\w+ ){1,4}(\d{1,4} ){1}(\w{1} )")
      regex2 = re.compile("(\w+ ){1,4}(\d{1,4} ){1}")
      regex3 = re.compile("(\w+ ){1,4}(\d){1,4}")
      regex4 = re.compile("(\w+ ){1,4}(\w+)")
  
      s1 = regex1.search(text)
      s2 = regex2.search(text)
      s3 = regex3.search(text)
      s4 = regex4.search(text)
  
      regex_address = ""
  
      if s1 != None:
          regex_address = s1.group()
      elif s2 != None:
          regex_address = s2.group()
      elif s3 != None:
          regex_address = s3.group()
      elif s4 != None:
          regex_address = s4.group()    
      else:
          regex_address = address
  
      return regex_address
  </code></pre>
  
  <p>I'm using Python 3.4</p>