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


Groups > comp.lang.python > #41032

Re: Regular expression problem

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 <mukeshtiwari.iiitm@gmail.com>
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 <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
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
X-Google-Web-Client true
X-Google-IP 115.254.66.3
MIME-Version 1.0
Subject Re: Regular expression problem
From mukesh tiwari <mukeshtiwari.iiitm@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.3162.1362941307.2939.python-list@python.org> (permalink)
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

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