title: Understanding the 're.search()' behavior in Python
body: <p>Here is the python code i have used to split up letters and digits from a string of alphanumerics:</p>
  
  <pre><code>input_string = 'abcdefghijklmnopqrstuvwxyz1234567890'
  import re
  print re.search('[a-z]*', input_string).group()
  print re.search('[0-9]*', input_string).group()
  </code></pre>
  
  <p>In output i am getting the string of letters but not getting the string of digits. If i modify the code like following the output is showing the digits:</p>
  
  <pre><code>print re.search('[0-9]*$', input_string).group()
  </code></pre>
  
  <p>I am used to <code>grep</code> and i found it's functionalities are similar to those of <code>re</code> module, if i run the following command in shell i get the desired result:</p>
  
  <pre><code>echo "abcdefghijklmnopqrstuvwxyz1234567890" | grep "[0-9]*"
  </code></pre>
  
  <p>Am i missing something here?</p>