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


Groups > comp.lang.python > #30780

Re: + in regular expression

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 2012-10-04 23:14 -0600
Subject Re: + in regular expression
Newsgroups comp.lang.python
Message-ID <mailman.1837.1349414085.27098.python-list@python.org> (permalink)

Show all headers | 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