title: How to extract data from the file by using regular expression in python?
body: <p>I have a file, in that emailid, phoneno and my dateofbirth is there. In python by using regular expression, how to find the 3 fields one by one? The desired output looks like</p>
  <pre><code>Emailid: x@gmail.com
  Phoneno: 1234567890
  dateofbirth: xx-xx-xx
  </code></pre>
  <p>I knew how to find the fields individually. But I am not aware how to find 3 at a time .The below snippet shows how to find the emailid from the file. This code output looks like</p>
  <pre><code>Emaildid: x@gmail.com
  </code></pre>
  <h1>...........................</h1>
  <pre><code>import sys,re
  
  pattern=r'''(?P&lt;emailid&gt;[a-zA-Z\.]*\@[a-zA-Z]*\.c[a-zA-Z]*)'''
  
  
  regobj = re.compile(pattern, re.VERBOSE)
  
  for line in sys.stdin:
    results= regobj.finditer(line)
  for result in results:
    sys.stdout.write(&quot;%s\n&quot;%result.group('emailid'))
  </code></pre>