Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.022 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'purpose.': 0.07; 'attachment.': 0.09; 'friday,': 0.09; 'lawrence': 0.09; 'question?': 0.09; 'throws': 0.09; 'stored': 0.10; 'reserves': 0.16; 'risk,': 0.16; 'skip:[ 60': 0.16; 'subject:expression': 0.16; 'subject:regular': 0.16; 'wrote:': 0.17; 'liable': 0.17; 'message-----': 0.17; 'to:name:python-list@python.org': 0.20; 'error.': 0.21; '"",': 0.22; 'disclaimer': 0.22; 'cheers,': 0.23; 'to:2**1': 0.23; 'raise': 0.24; 'header:In-Reply-To:1': 0.25; 'skip:" 20': 0.26; '(most': 0.27; 'regular': 0.27; '>>>>': 0.29; 'url:mailman': 0.29; 'skip:_ 10': 0.29; 'checks': 0.30; 'distribute': 0.30; 'url:python': 0.32; 'file': 0.32; 'skip:- 10': 0.32; 'url:listinfo': 0.32; 'message.': 0.33; 'damage': 0.33; 'traceback': 0.33; 'viruses.': 0.33; 'to:addr:python-list': 0.33; 'monitor': 0.33; 'posting': 0.35; 'subject:': 0.36; 'but': 0.36; 'url:org': 0.36; 'actions': 0.36; 'email addr:python.org': 0.36; 'should': 0.36; 'too': 0.36; 'charset:us-ascii': 0.36; 'address.': 0.36; 'october': 0.37; 'why': 0.37; 'sent:': 0.37; 'mark': 0.38; 'from:': 0.38; 'some': 0.38; 'received:10': 0.38; 'delete': 0.38; 'instead': 0.39; 'system.': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'end': 0.40; 'url:mail': 0.40; 'your': 0.60; 'address': 0.60; 'first': 0.61; 'email name:python-list': 0.62; 'repeat': 0.62; 'information': 0.63; 'virus': 0.66; 'received:122': 0.70; 'e-mail.': 0.71; 'food': 0.71; 'further,': 0.71; 'sustain': 0.84; 'to:addr:yahoo.co.uk': 0.84 X-TM-IMSS-Message-ID: <26c73bd5003c8b7b@infosys.com> From: Saroo Jain To: Mark Lawrence , "python-list@python.org" Subject: RE: + in regular expression Thread-Topic: + in regular expression Thread-Index: AQHNopoLwUpQsSrUvUidULW5vUKhbJeqEcIA Date: Fri, 5 Oct 2012 03:44:25 +0000 References: In-Reply-To: Accept-Language: en-US, en-IN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.66.236.164] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: , Newsgroups: comp.lang.python Message-ID: Lines: 74 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349408939 news.xs4all.nl 6925 [2001:888:2000:d::a6]:55331 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30777 x3=3Dre.match("\s{6}+",str) instead use x3=3Dre.match("\s{6,}",str) This serves the purpose. And also give some food for thought for why the = first one throws an error. Cheers, Saroo -----Original Message----- From: Python-list [mailto:python-list-bounces+saroo_jain=3Dinfosys.com@py= thon.org] On Behalf Of Mark Lawrence Sent: Friday, October 05, 2012 3:29 AM To: python-list@python.org Subject: Re: + in regular expression On 04/10/2012 04:01, contro opinion wrote: >>>> str=3D" gg" >>>> x1=3Dre.match("\s+",str) >>>> x1 > <_sre.SRE_Match object at 0xb7354db0> >>>> x2=3Dre.match("\s{6}",str) >>>> x2 > <_sre.SRE_Match object at 0xb7337f38> >>>> x3=3Dre.match("\s{6}+",str) > Traceback (most recent call last): > File "", line 1, in > File "/usr/lib/python2.6/re.py", line 137, in match > return _compile(pattern, flags).match(string) > File "/usr/lib/python2.6/re.py", line 245, in _compile > raise error, v # invalid expression > sre_constants.error: multiple repeat >>>> > > why the "\s{6}+" is not a regular pattern? > > > Why are you too lazy to do any research before posting a question? -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list **************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended sol= ely for the use of the addressee(s). If you are not the intended recipient, p= lease notify the sender by e-mail and delete the original message. Further, you= are not to copy, disclose, or distribute this e-mail or its contents to any other= person and any such actions are unlawful. This e-mail may contain viruses. Infosys h= as taken every reasonable precaution to minimize this risk, but is not liable for = any damage you may sustain as a result of any virus in this e-mail. You should carry= out your own virus checks before opening the e-mail or attachment. Infosys reserve= s the right to monitor and review the content of all messages sent to or from t= his e-mail address. Messages sent to or from this e-mail address may be stored on th= e Infosys e-mail system. ***INFOSYS******** End of Disclaimer ********INFOSYS***