+ in regular expression

Ian Kelly ian.g.kelly at gmail.com
Fri Oct 5 01:14:13 EDT 2012


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



More information about the Python-list mailing list