Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41031

Re: Regular expression problem

X-Received by 10.224.175.65 with SMTP id w1mr6923877qaz.7.1362941298071; Sun, 10 Mar 2013 11:48:18 -0700 (PDT)
X-Received by 10.50.150.166 with SMTP id uj6mr586034igb.1.1362941298026; Sun, 10 Mar 2013 11:48:18 -0700 (PDT)
Path csiph.com!usenet.pasdenom.info!poup.poupinou.org!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!209.85.216.87.MISMATCH!t2no476812qal.0!news-out.google.com!o5ni454qas.0!nntp.google.com!dd2no502547qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Sun, 10 Mar 2013 11:48:16 -0700 (PDT)
In-Reply-To <mailman.3160.1362938932.2939.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=115.254.66.3; posting-account=utVMDgoAAACBclB38JUYjL1LjVN2Gha6
NNTP-Posting-Host 115.254.66.3
References <c24ab822-a3f4-4faf-8a6d-2e1fde6552ae@googlegroups.com> <CAPTjJmri_eV3mzG9hvGvuiHd-Kb4uwvgzPypmmhZ83U_jV7AJg@mail.gmail.com> <mailman.3160.1362938932.2939.python-list@python.org>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <a5a2bd74-4d7e-45c1-aad2-2f67cf9bd9fe@googlegroups.com> (permalink)
Subject Re: Regular expression problem
From mukesh tiwari <mukeshtiwari.iiitm@gmail.com>
Cc python-list@python.org
Injection-Date Sun, 10 Mar 2013 18:48:18 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.python:41031

Show key headers only | View raw


Hi Chris
Thank you! Now I am getting wrong answer so at least program is faster then previous one and I am looking for wrong answer reason. Thanks again!

import re

if __name__ == "__main__":
    n = int ( raw_input() )
    c = 1
    while c <= n :
        email =  filter ( lambda x : x != None , [ re.search ( '[a-zA-Z0-9][a-zA-Z0-9._]{4,}@[a-zA-Z0-9]+.(com|edu|org|co.in)' , x ) for x in raw_input().split(' ') ] )
        t = len ( email )
        print 'Case #' + str ( c ) + ': ' + str ( t )
        for i in xrange ( t ) : 
            print email[i].group()
        c += 1

Regards 
Mukesh Tiwari

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Regular expression problem mukesh tiwari <mukeshtiwari.iiitm@gmail.com> - 2013-03-10 10:42 -0700
  Re: Regular expression problem Chris Angelico <rosuav@gmail.com> - 2013-03-11 04:59 +1100
    Re: Regular expression problem mukesh tiwari <mukeshtiwari.iiitm@gmail.com> - 2013-03-10 11:05 -0700
    Re: Regular expression problem mukesh tiwari <mukeshtiwari.iiitm@gmail.com> - 2013-03-10 11:05 -0700
  Re: Regular expression problem Chris Angelico <rosuav@gmail.com> - 2013-03-11 05:08 +1100
    Re: Regular expression problem mukesh tiwari <mukeshtiwari.iiitm@gmail.com> - 2013-03-10 11:48 -0700
      Re: Regular expression problem Chris Angelico <rosuav@gmail.com> - 2013-03-11 05:57 +1100
    Re: Regular expression problem mukesh tiwari <mukeshtiwari.iiitm@gmail.com> - 2013-03-10 11:48 -0700
  Re: Regular expression problem Terry Reedy <tjreedy@udel.edu> - 2013-03-10 22:06 -0400
    Re: Regular expression problem jmfauth <wxjmfauth@gmail.com> - 2013-03-11 02:28 -0700
      Re: Regular expression problem Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-11 10:19 +0000
      Re: Regular expression problem rusi <rustompmody@gmail.com> - 2013-03-11 06:18 -0700
      On topic, please [Was:Re: Regular expression problem] Ned Deily <nad@acm.org> - 2013-03-11 11:13 -0700
  Re: Regular expression problem Serhiy Storchaka <storchaka@gmail.com> - 2013-03-11 20:30 +0200
  Re: Regular expression problem Terry Reedy <tjreedy@udel.edu> - 2013-03-11 16:23 -0400

csiph-web