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


Groups > comp.lang.python > #45881

Utility to locate errors in regular expressions

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'causing': 0.04; 'tree': 0.05; 'parser': 0.07; 'remaining': 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; 'python': 0.11; 'appreciated!': 0.16; 'exists?': 0.16; 'expression.': 0.16; 'expressions,': 0.16; 'of)': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:expressions': 0.16; 'subject:regular': 0.16; 'charset:iso-8859-15': 0.16; 'header:User-Agent:1': 0.23; '(or': 0.24; 'header:X-Complaints- To:1': 0.27; 'idea': 0.28; 'dropped': 0.31; 'regular': 0.32; 'could': 0.34; 'advice': 0.35; 'problem.': 0.35; 'but': 0.35; 'representing': 0.36; 'similar': 0.36; 'should': 0.36; 'to:addr :python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'expression': 0.60; 'first': 0.61; 'complete': 0.62; 'bottom': 0.67; 'received:93': 0.72; 'step,': 0.84; 'from.': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Malte Forkel <malte.forkel@berlin.de>
Subject Utility to locate errors in regular expressions
Date Fri, 24 May 2013 14:58:24 +0200
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-15
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host p5ddb02f5.dip0.t-ipconnect.de
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
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.2062.1369400329.3114.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369400329 news.xs4all.nl 15971 [2001:888:2000:d::a6]:53438
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45881

Show key headers only | View raw


Finding out why a regular expression does not match a given string can
very tedious. I would like to write a utility that identifies the
sub-expression causing the non-match. My idea is to use a parser to
create a tree representing the complete regular expression. Then I could
simplify the expression by dropping sub-expressions one by one from
right to left and from bottom to top until the remaining regex matches.
The last sub-expression dropped should be (part of) the problem.

As a first step, I am looking for a parser for Python regular
expressions, or a Python regex grammar to create a parser from.

But may be my idea is flawed? Or a similar (or better) tools already
exists? Any advice will be highly appreciated!

Malte

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


Thread

Utility to locate errors in regular expressions Malte Forkel <malte.forkel@berlin.de> - 2013-05-24 14:58 +0200
  Re: Utility to locate errors in regular expressions Roy Smith <roy@panix.com> - 2013-05-24 09:12 -0400
    Re: Utility to locate errors in regular expressions Neil Cerutti <neilc@norwich.edu> - 2013-05-24 13:58 +0000
  Re: Utility to locate errors in regular expressions rusi <rustompmody@gmail.com> - 2013-05-24 07:09 -0700
  Re: Utility to locate errors in regular expressions Christian Gollwitzer <auriocus@gmx.de> - 2013-05-24 20:21 +0200

csiph-web