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


Groups > comp.lang.python > #78806

Re: How do I check if a string is a prefix of any possible other string that matches a given regex.

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <joshua.landau.ws@gmail.com>
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; 'expressions': 0.07; 'matches': 0.07; 'string': 0.09; 'counting': 0.09; 'prefix': 0.09; 'prefixes': 0.09; 'subject:string': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'question.': 0.14; 'subject: \n ': 0.16; 'subject:possible': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'library': 0.18; 'machine': 0.22; 'input': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'point': 0.28; 'characters': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'that.': 0.31; 'subject:other': 0.31; 'subject:that': 0.31; 'probably': 0.32; 'regular': 0.32; 'run': 0.32; 'another': 0.32; 'running': 0.33; "i'd": 0.34; 'but': 0.35; 'received:google.com': 0.35; '(we': 0.36; 'possible': 0.36; 'should': 0.36; 'does': 0.39; 'how': 0.40; 'to:addr:gmail.com': 0.65; 'subject:check': 0.84; 'upside': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=aLUDRvjzl+wjS1QVBSpZrmpLpWhvsWKI/5hP+v9R/5k=; b=xSk0D9gcf796HOeNnZb2JUDwbEVp/Yqe6u48grugKXdb4lTwNXTkFUls4meYI/z4Yl AS/D6jBG/97dPg+4sUJFHI6iFztC8u8wppPjo/OH+Aw2uq8KT7d9AT+7A255vUp6dWUs UMGjxa8m3Zc4gDewCp2zwWgHjzVEna5/SlnkB0eaHDJdDxLqPY5cG0nVM3qFoHKAjpZG PV3oG77cv1IQnFpSM6pzktz4PYjGEO2o9XWVQo/1778r64lCyqiIgbPaYIXEN7KcEw4v G8o+QHyqBh9PqXf5WeHZYziZ0O0IS67mdfrms7HdEqiQVlgd4xGrHL6NkF6JI9IVt24w Avpw==
X-Received by 10.112.129.228 with SMTP id nz4mr5330551lbb.9.1412701356797; Tue, 07 Oct 2014 10:02:36 -0700 (PDT)
MIME-Version 1.0
Sender joshua.landau.ws@gmail.com
In-Reply-To <dbf06cce-19ae-4859-9cc1-97f70d1bacfb@googlegroups.com>
References <dbf06cce-19ae-4859-9cc1-97f70d1bacfb@googlegroups.com>
From Joshua Landau <joshua@landau.ws>
Date Tue, 7 Oct 2014 18:01:56 +0100
X-Google-Sender-Auth jbXl2Iwv5FCd3UcDZnIDNCeKqTM
Subject Re: How do I check if a string is a prefix of any possible other string that matches a given regex.
To jonathan.slenders@gmail.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list <python-list@python.org>
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.14662.1412701359.18130.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1412701359 news.xs4all.nl 2875 [2001:888:2000:d::a6]:53713
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:78806

Show key headers only | View raw


On 7 October 2014 17:15,  <jonathan.slenders@gmail.com> wrote:
> Probably I'm turning the use of regular expressions upside down with this question. I don't want to write a regex that matches prefixes of other strings, I know how to do that. I want to generate a regex -- given another regex --, that matches all possible strings that are a prefix of a string that matches the given regex.
> [...]
> Logically, I'd think it should be possible by running the input string against the state machine that the given regex describes, and if at some point all the input characters are consumed, it's a match. (We don't have to run the regex until the end.) But I cannot find any library that does it...

How wide a net are you counting "regular expressions" to be? What
grammar are you using?

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


Thread

How do I check if a string is a prefix of any possible other string that matches a given regex. jonathan.slenders@gmail.com - 2014-10-07 09:15 -0700
  Re: How do I check if a string is a prefix of any possible other string that matches a given regex. Joshua Landau <joshua@landau.ws> - 2014-10-07 18:01 +0100
  Re: How do I check if a string is a prefix of any possible other string that matches a given regex. Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-07 12:35 -0600
    Re: How do I check if a string is a prefix of any possible other string that matches a given regex. jonathan.slenders@gmail.com - 2014-10-07 14:48 -0700
      Re: How do I check if a string is a prefix of any possible other string that matches a given regex. MRAB <python@mrabarnett.plus.com> - 2014-10-08 00:39 +0100
        Re: How do I check if a string is a prefix of any possible other string that matches a given regex. jonathan.slenders@gmail.com - 2014-10-08 01:48 -0700
      Re: How do I check if a string is a prefix of any possible other   string that matches a given regex. Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-10-09 10:24 +1300

csiph-web