title: Reaching a middle ground between search() and findall() in regular expressions
body: <p>A personal project requiring me to create regular expressions for IP addresses led me to the following standoff.</p>
  
  <pre><code>pattern = r'123\.145\.167\.[0-9]{1,2}'
  source = "123.145.167.0, 123.145.167.99, 123.145.167.100"
  n = re.search(pattern, source)
  print n.group()
  
  
  pattern = r'123\.145\.167\.[0-9]{1,2}'
  source = "123.145.167.0, 123.145.167.99, 123.145.167.100"
  n = re.compile(pattern)
  print n.findall(source)
  </code></pre>
  
  <p>While using search matches only the first element in the source string, findall creates a problem by giving an output such as this</p>
  
  <pre><code>['123.145.167.0', '123.145.167.99', '123.145.167.10']
  </code></pre>
  
  <p>Is it possible that I can obtain the matches for both 123.145.167.0 and 123.145.167.99 and not the 123.145.167.100 ?</p>
  
  <p>I have already gone thorough <a href="https://stackoverflow.com/questions/8110059/python-regex-search-and-findall">python - regex search and findall</a> and yet not able to understand how I can solve my problem.</p>