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


Groups > comp.lang.python > #70680

Re: possible bug in re expression?

From Robin Becker <robin@reportlab.com>
Subject Re: possible bug in re expression?
Date 2014-04-28 14:06 +0100
References <535A8DB5.4090109@chamonix.reportlab.co.uk> <lje9ou$8do$1@ger.gmane.org> <mailman.9545.1398678492.18130.python-list@python.org> <535e4037$0$29965$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.9548.1398690389.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 28/04/2014 12:49, Steven D'Aprano wrote:
......
>
> Well, I don't know about "almost any", but at least some broken regexes
> will explicitly fail:
>
>
>
> py> import re
........
> sre_constants.error: nothing to repeat
>
> (For brevity I have abbreviated the traceback.)
>
so there is intent to catch some specification errors.

I've abandoned this translation anyhow as all that was intended was to split the 
string into non-overlapping strings of size at most k. I find this works faster 
than the regexp even if the regexp is pre-compiled.

[p[i:i+k] for i in xrange(0,len(p),k)]
-- 
Robin Becker

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


Thread

Re: possible bug in re expression? Robin Becker <robin@reportlab.com> - 2014-04-28 10:47 +0100
  Re: possible bug in re expression? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-04-28 11:49 +0000
    Re: possible bug in re expression? Robin Becker <robin@reportlab.com> - 2014-04-28 14:06 +0100

csiph-web