Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder1.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '"__main__":': 0.07; '__name__': 0.07; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'lambda': 0.16; 'len': 0.16; 'reason.': 0.16; "skip:' 60": 0.16; 'subject:Regular': 0.16; 'subject:expression': 0.16; 'xrange': 0.16; 'import': 0.21; 'subject:problem': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'chris': 0.28; 'str': 0.29; 'print': 0.32; 'getting': 0.33; 'int': 0.33; 'received:google.com': 0.34; 'wrong': 0.34; 'thanks': 0.34; 'faster': 0.35; 'filter': 0.35; 'received:209.85': 0.35; 'thank': 0.36; 'previous': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'again!': 0.84 X-Received: by 10.50.150.166 with SMTP id uj6mr586034igb.1.1362941298026; Sun, 10 Mar 2013 11:48:18 -0700 (PDT) Newsgroups: comp.lang.python Date: Sun, 10 Mar 2013 11:48:16 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=115.254.66.3; posting-account=utVMDgoAAACBclB38JUYjL1LjVN2Gha6 References: User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 115.254.66.3 MIME-Version: 1.0 Subject: Re: Regular expression problem From: mukesh tiwari To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362941307 news.xs4all.nl 6864 [2001:888:2000:d::a6]:36248 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41032 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