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


Groups > comp.lang.python > #70680

Re: possible bug in re expression?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'broken': 0.04; 'explicitly': 0.05; 'subject:bug': 0.07; 'string': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'translation': 0.12; '.........': 0.16; 'abbreviated': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:expression': 0.16; 'subject:possible': 0.16; 'wrote:': 0.18; 'split': 0.19; 'import': 0.22; 'header:User-Agent:1': 0.23; 'errors.': 0.24; "i've": 0.25; 'least': 0.26; '(for': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; "d'aprano": 0.31; 'steven': 0.31; 'but': 0.35; 'there': 0.35; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:x 10': 0.40; 'even': 0.60; 'catch': 0.60; 'most': 0.60; 'skip:n 10': 0.64; 'received:109': 0.72; 'repeat': 0.74; 'regexp': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Robin Becker <robin@reportlab.com>
Subject Re: possible bug in re expression?
Date Mon, 28 Apr 2014 14:06:08 +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>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 109.174.168.73
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
In-Reply-To <535e4037$0$29965$c3e8da3$5496439d@news.astraweb.com>
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 <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9548.1398690389.18130.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1398690389 news.xs4all.nl 2973 [2001:888:2000:d::a6]:43328
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:70680

Show key headers only | 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