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


Groups > comp.lang.python > #30780

Re: + in regular expression

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.029
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'matches': 0.07; 'purpose.': 0.07; 'throws': 0.09; 'jain': 0.16; 'multiples': 0.16; 'oct': 0.16; 'subject:expression': 0.16; 'subject:regular': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'error.': 0.21; 'header:In-Reply- To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'why': 0.37; 'received:209': 0.37; 'some': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'first': 0.61; 'more': 0.63; 'six': 0.65; 'food': 0.71; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=SFl4O21zGLc9k4aSF5AH+THbpylqhbYeBDELEb6w4dc=; b=zPDpkKiJuIVLmyABNgFDqnwCK1N+E5cxdHgHQkjZDoVYxFENeRksjmAtIgGoCfCsZX mn2vNycaPxKIPTHeZRb5+3qWijekmAgYZFy5/xE0MHtn2ukvctQRzp7UCScMTzcG8UED pxdlA8glF4+XaAbQWu0clJcHwkffYnZuk2/qRqaEuMtgmYZFAMbjurwRx5F+3KhL27gU WxjAvCnS8NyROEyk6GEKY+2/AUs+A3xK6M6w2pRU5aB8PZdBbXwwdgZCJQh6i6GPizUg So73Xk00veqCtqDmiWkZKQw6lIchOS27ghq3bblBpubsNWr4AmUwYaItiAYrk7oY3aWc Xjow==
MIME-Version 1.0
In-Reply-To <9824145E4C0B6C4A94BEF7CE7692E808199E4064@BLRKECMBX22.ad.infosys.com>
References <CA+YdQ_4qK+UGjxpuzjsg3rVQfcQVLPgPB1SqP6Y+REa=OB8ZYQ@mail.gmail.com> <k4l0nq$udn$1@ger.gmane.org> <9824145E4C0B6C4A94BEF7CE7692E808199E4064@BLRKECMBX22.ad.infosys.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 4 Oct 2012 23:14:13 -0600
Subject Re: + in regular expression
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
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.1837.1349414085.27098.python-list@python.org> (permalink)
Lines 9
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1349414085 news.xs4all.nl 6955 [2001:888:2000:d::a6]:44140
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:30780

Show key headers only | View raw


On Thu, Oct 4, 2012 at 9:44 PM, Saroo Jain <Saroo_Jain@infosys.com> wrote:
> 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.

That matches six or more spaces, not multiples of six spaces.

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


Thread

Re: + in regular expression Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-04 23:14 -0600

csiph-web