title: Extracting phone numbers from a free form text in python by using regex
body: <p>I have to extract phone numbers from free form of texts.</p>
  
  <p>How can I manage it by using reg-ex in python?</p>
  
  <p>I have found for one in order to extract e-mail addresses. https://gist.github.com/dideler/5219706</p>
  
  <p>I have implemented the same approach by using a phone number regex instead of e-mail address regex, but I couldn't get output.</p>
  
  <pre><code>def get_phoneNumber(text):
          phone_number = ""
          regex = re.compile("((\(\d{3,4}\)|\d{3,4}-)\d{4,9}(-\d{1,5}|\d{0}))|(\d{4,12})")
  
          for phoneNumber in get_phoneNumbers(text, regex):
                  phone_number = phone_number + phoneNumber + "\n"
  
          return phone_Number
  
  def get_phoneNumbers(s, regex):
          return (phoneNumber[0] for phoneNumber in re.findall(regex, s)
  </code></pre>
  
  <p>How can I manage to do it?</p>