Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30777
| 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 | <Saroo_Jain@infosys.com> |
| 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 <Saroo_Jain@infosys.com> |
| To | Mark Lawrence <breamoreboy@yahoo.co.uk>, "python-list@python.org" <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 | <CA+YdQ_4qK+UGjxpuzjsg3rVQfcQVLPgPB1SqP6Y+REa=OB8ZYQ@mail.gmail.com> <k4l0nq$udn$1@ger.gmane.org> |
| In-Reply-To | <k4l0nq$udn$1@ger.gmane.org> |
| 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 <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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1835.1349408939.27098.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
x3=re.match("\s{6}+",str)
instead use
x3=re.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=infosys.com@python.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=" gg"
>>>> x1=re.match("\s+",str)
>>>> x1
> <_sre.SRE_Match object at 0xb7354db0>
>>>> x2=re.match("\s{6}",str)
>>>> x2
> <_sre.SRE_Match object at 0xb7337f38>
>>>> x3=re.match("\s{6}+",str)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> 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 solely
for the use of the addressee(s). If you are not the intended recipient, please
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 has 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 reserves the
right to monitor and review the content of all messages sent to or from this e-mail
address. Messages sent to or from this e-mail address may be stored on the
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
RE: + in regular expression Saroo Jain <Saroo_Jain@infosys.com> - 2012-10-05 03:44 +0000
csiph-web