Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Science is what happens when preconception meets verification.


devel / comp.lang.python / Re: Regular Expression bug?

SubjectAuthor
* Re: Regular Expression bug?jose isaias cabrera
`* Re: Regular Expression bug?Alan Bawden
 `- Re: Regular Expression bug?jose isaias cabrera

1
Re: Regular Expression bug?

<mailman.2140.1677805635.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22159&group=comp.lang.python#22159

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: jic...@gmail.com (jose isaias cabrera)
Newsgroups: comp.lang.python
Subject: Re: Regular Expression bug?
Date: Thu, 2 Mar 2023 20:06:59 -0500
Lines: 43
Message-ID: <mailman.2140.1677805635.20444.python-list@python.org>
References: <CAO+295u7pkb+qpuqR4-FnX_+6A6_DEcUbKDrSJT88Exgx2Xf3w@mail.gmail.com>
<CAPTjJmqEU6r+s6Rt9x6xE6Kx_gm=YEf3MFwKMpZpkQihXUa+Jw@mail.gmail.com>
<0556af4d-279d-8bf0-973d-54ea5e30f764@wichmann.us>
<CAO+295uSGRp7LqQT=v2GiQ06ahzkEmZgqwmJX7UsJiW7H+6i2g@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de nX1yGWi98NY+DBYrME4IaAnV2NqBdzNAkWrb6lKGG7ZQ==
Return-Path: <jicman@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=HDaZ2Nwj;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '&gt;&gt;&gt;': 0.07;
'2023': 0.07; 'mar': 0.07; 'used.': 0.07; 'wrong.': 0.07;
'angelico': 0.09; 'cc:addr:python-list': 0.09; 'subject:bug':
0.09; '&gt;': 0.14; 'cc:no real name:2**0': 0.14; 'import': 0.15;
'>>>>>': 0.16; 'mats': 0.16; 'part.': 0.16; 'python3': 0.16;
'regexp': 0.16; 'to:name:mats wichmann': 0.16; 'url:howto': 0.16;
'url:regex': 0.16; 'wichmann': 0.16; 'wrote:': 0.16; 'thu,': 0.19;
'cc:addr:python.org': 0.20; 'fri,': 0.22; 'cc:2**0': 0.25;
'space': 0.26; 'bit': 0.27; '>>>': 0.28; 'chris': 0.28; 'goes':
0.28; 'it,': 0.29; 'message-id:@mail.gmail.com': 0.32;
'appreciated.': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'trying': 0.35; 'following': 0.35;
'from:addr:gmail.com': 0.35; 'received:209.85': 0.37;
'received:209': 0.39; 'use': 0.39; 'match': 0.40; 'want': 0.40;
'should': 0.40; 'between': 0.63; 'everything': 0.63; 'skip:r 20':
0.64; 'upgrade': 0.64; 'subject:Regular': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112; t=1677805633;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:from:to:cc:subject:date:message-id:reply-to;
bh=fjZOvo/ru5iN7too+7j67yBKzlJE3PG9M9RtvRZMEMQ=;
b=HDaZ2Nwjjxm4GAVm/KjMMKv0DRUR+A9PJH2CQW58jQ0kGywp0I5858n49KFV8M/HjC
3Ld6sPox6n1TjUg2J8JBjHmpCb28bmcTguouPclxLrsuPmmqsfzT0Y/qemXmFvOqV4qx
mgvKekOAgqJBcHgahINKuOJZIrtNqqqmKW9o/d5dFyoJ9Mfc+2QpTBUSes6CwtUPhozJ
RRXtGzDo04LtGPkyHFlYGHXDA/0SxHGDgb0Hz564Pc/Vd5pk5gI3PhsaF9ilLqnJtHvB
5+mkrPEntDaANzd3XlIsR9HH4wMSTQ89ieGZGTMY1j5N/BKOyuZ8iO6xqc5Bp9GR+1oK
PBSA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112; t=1677805633;
h=cc:to:subject:message-id:date:from:in-reply-to:references
:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=fjZOvo/ru5iN7too+7j67yBKzlJE3PG9M9RtvRZMEMQ=;
b=Bs+XZ7xTerWOuymJoXeSv/v18nJJALwEMmMHczDk66xrZUzNJjZGuIWLRwMo+qhi45
PSbATRqgUAqgV3cNh5QL0+0lLPcYaorPTF2PLwJSbRhqyscrDc9eW3UXwxjZH0yg+kIB
qc+DxRGVdEcE+NWGVkDWc7lMe6psMUXI+ppNfAUzV0cqnbBucAhE3YXc1HrneVbf4Rmy
MKohqfXItrxfFAEQX4N5WaCO9Rse1dTBT8Rms2thsqbyR/jSgfWLxuDF4OQNNes2jB0t
2Q5UpkU0EdzY5kC3Vs6nTvUC6/i8Nv0Z/gp37gK9t/UmNFe7ZxVhwhgwai4hy6HGSLu+
YZFQ==
X-Gm-Message-State: AO0yUKXCVLXPtS2ZJbEe1P1WRCLs9jCPhYHue2dIrwt9xcKzx1cvTiit
468zicosObvYUlALXbXtACNCC7aJbW/S8OPbzx7rSDiDV8I=
X-Google-Smtp-Source: AK7set9U1YlR7fjJkNfTkv8ky0zb87a8UD2nSYH+5Uw7GckKnGZKsTGwbTIdRrdQeV9JpkjuPY7HZkufR1zheT7wtiI=
X-Received: by 2002:a05:600c:329c:b0:3df:d8c9:caa7 with SMTP id
t28-20020a05600c329c00b003dfd8c9caa7mr9302wmp.4.1677805633280; Thu, 02 Mar
2023 17:07:13 -0800 (PST)
In-Reply-To: <0556af4d-279d-8bf0-973d-54ea5e30f764@wichmann.us>
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <https://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>
X-Mailman-Original-Message-ID: <CAO+295uSGRp7LqQT=v2GiQ06ahzkEmZgqwmJX7UsJiW7H+6i2g@mail.gmail.com>
X-Mailman-Original-References: <CAO+295u7pkb+qpuqR4-FnX_+6A6_DEcUbKDrSJT88Exgx2Xf3w@mail.gmail.com>
<CAPTjJmqEU6r+s6Rt9x6xE6Kx_gm=YEf3MFwKMpZpkQihXUa+Jw@mail.gmail.com>
<0556af4d-279d-8bf0-973d-54ea5e30f764@wichmann.us>
 by: jose isaias cabrera - Fri, 3 Mar 2023 01:06 UTC

On Thu, Mar 2, 2023 at 2:38 PM Mats Wichmann <mats@wichmann.us> wrote:
>
> On 3/2/23 12:28, Chris Angelico wrote:
> > On Fri, 3 Mar 2023 at 06:24, jose isaias cabrera <jicman@gmail.com>
wrote:
> >>
> >> Greetings.
> >>
> >> For the RegExp Gurus, consider the following python3 code:
> >> <code>
> >> import re
> >> s = "pn=align upgrade sd=2023-02-"
> >> ro = re.compile(r"pn=(.+) ")
> >> r0=ro.match(s)
> >>>>> print(r0.group(1))
> >> align upgrade
> >> </code>
> >>
> >> This is wrong. It should be 'align' because the group only goes up-to
> >> the space. Thoughts? Thanks.
> >>
> >
> > Not a bug. Find the longest possible match that fits this; as long as
> > you can find a space immediately after it, everything in between goes
> > into the .+ part.
> >
> > If you want to exclude spaces, either use [^ ]+ or .+?.
>
> https://docs.python.org/3/howto/regex.html#greedy-versus-non-greedy

This re is a bit different than the one I am used. So, I am trying to match
everything after 'pn=':

import re
s = "pm=jose pn=2017"
m0 = r"pn=(.+)"
r0 = re.compile(m0)
s0 = r0.match(s)
>>> print(s0)
None

Any help is appreciated.

Re: Regular Expression bug?

<86mt4uwqnv.fsf@williamsburg.bawden.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22161&group=comp.lang.python#22161

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ala...@csail.mit.edu (Alan Bawden)
Newsgroups: comp.lang.python
Subject: Re: Regular Expression bug?
Date: Thu, 02 Mar 2023 20:48:52 -0500
Organization: ITS Preservation Society
Lines: 21
Message-ID: <86mt4uwqnv.fsf@williamsburg.bawden.org>
References: <CAO+295u7pkb+qpuqR4-FnX_+6A6_DEcUbKDrSJT88Exgx2Xf3w@mail.gmail.com>
<CAPTjJmqEU6r+s6Rt9x6xE6Kx_gm=YEf3MFwKMpZpkQihXUa+Jw@mail.gmail.com>
<0556af4d-279d-8bf0-973d-54ea5e30f764@wichmann.us>
<CAO+295uSGRp7LqQT=v2GiQ06ahzkEmZgqwmJX7UsJiW7H+6i2g@mail.gmail.com>
<mailman.2140.1677805635.20444.python-list@python.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader01.eternal-september.org; posting-host="205c46e1b063d3b97bb6533ac4d49d7c";
logging-data="475853"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bD2zVHsvrrgIrJZtCR9NV"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Cancel-Lock: sha1:bgIxP82TQGbCeZ7tyHAYt+WSz34=
sha1:fdFGg2CaOo1egPi4j3Wnut5ng7g=
 by: Alan Bawden - Fri, 3 Mar 2023 01:48 UTC

jose isaias cabrera <jicman@gmail.com> writes:

On Thu, Mar 2, 2023 at 2:38 PM Mats Wichmann <mats@wichmann.us> wrote:

This re is a bit different than the one I am used. So, I am trying to match
everything after 'pn=':

import re
s = "pm=jose pn=2017"
m0 = r"pn=(.+)"
r0 = re.compile(m0)
s0 = r0.match(s)
>>> print(s0)
None

Assuming that you were expecting to match "pn=2017", then you probably
don't want the 'match' method. Read its documentation. Then read the
documentation for the _other_ methods that a Pattern supports. Then you
will be enlightened.

- Alan

Re: Regular Expression bug?

<mailman.2145.1677814626.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=22165&group=comp.lang.python#22165

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: jic...@gmail.com (jose isaias cabrera)
Newsgroups: comp.lang.python
Subject: Re: Regular Expression bug?
Date: Thu, 2 Mar 2023 22:36:52 -0500
Lines: 29
Message-ID: <mailman.2145.1677814626.20444.python-list@python.org>
References: <CAO+295u7pkb+qpuqR4-FnX_+6A6_DEcUbKDrSJT88Exgx2Xf3w@mail.gmail.com>
<CAPTjJmqEU6r+s6Rt9x6xE6Kx_gm=YEf3MFwKMpZpkQihXUa+Jw@mail.gmail.com>
<0556af4d-279d-8bf0-973d-54ea5e30f764@wichmann.us>
<CAO+295uSGRp7LqQT=v2GiQ06ahzkEmZgqwmJX7UsJiW7H+6i2g@mail.gmail.com>
<mailman.2140.1677805635.20444.python-list@python.org>
<86mt4uwqnv.fsf@williamsburg.bawden.org>
<CAO+295tv0wCO+qqqtLwPdhiox6Fz+AMRbhLJ_GTRy4MVkAqqAw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de reuGhLfUAhweMw5OSe2tSQDCQdueINPfEyydsHSWMVUQ==
Return-Path: <jicman@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=m5BVs+9L;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '2023': 0.07; 'mar': 0.07;
'used.': 0.07; 'cc:addr:python-list': 0.09; 'subject:bug': 0.09;
'writes:': 0.09; 'yes.': 0.09; 'cc:no real name:2**0': 0.14;
'import': 0.15; '9:56': 0.16; 'assuming': 0.16; 'mats': 0.16;
'received:209.85.221.54': 0.16; 'received:mail-
wr1-f54.google.com': 0.16; 'wichmann': 0.16; 'wrote:': 0.16;
'probably': 0.17; 'it?': 0.19; 'thu,': 0.19; 'cc:addr:python.org':
0.20; 'cc:2**0': 0.25; 'pattern': 0.26; 'bit': 0.27; '>>>': 0.28;
'message-id:@mail.gmail.com': 0.32; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'trying': 0.35;
'from:addr:gmail.com': 0.35; 'received:209.85': 0.37; 'read':
0.38; 'received:209': 0.39; 'methods': 0.39; 'alan': 0.40;
'match': 0.40; 'want': 0.40; 'everything': 0.63; 'spend': 0.64;
'subject:Regular': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112; t=1677814624;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=pIL3h1GaDzxTJCKnsTnR7t2ctBnEVSVwBh6vPGx+MpA=;
b=m5BVs+9LCJBxksjH7BavYK5WrTxbLDGsWq0UkyybCbLLnQhcSRgajbMGODmrVrbKhL
eLSuqlm/5tOqd+S/c43Sl6IUrtbSqzPh5zs/NL6u6CE43oNw8jVZqA2ng20VK5rELXb1
qsxgVxR6t1ni2Xq2e8LYvNlHTzVdUBfZtAcjpmyadpK/Lono/3MRPhfENL+krls8p3l/
H1L7z1GFtOAHmExyzqFEeCBakoSyGCnM9Bc61L839nKP9fvYaQNK8VSTk+pMx30W9vRs
Ow/BDgdzxe43mF0hEWlVmq+AB/n5+sltPXHv/Av1HOMGGYYiYNh26g5bNC2kSjR2IlFd
DfGw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112; t=1677814624;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=pIL3h1GaDzxTJCKnsTnR7t2ctBnEVSVwBh6vPGx+MpA=;
b=sue9bPZOCmAiGfsh6KibOW+3T8J+hvXNCN8aX6DEKFdKoFJy7vTL6GXA/3HFCrUdam
SbJ/q0y3nxJNoskstJcgtqXTAaNlvvGj4mt7xoynO7/0pdG/tsWwvK1DxCNjBNKIxywQ
10AIDcF30x339LCHYm3sNVbp4MFohGZ4fdV/8otOVOb9mNrQL7WIWEKGPIANHQ7koaFh
pSGAivxf0KoztgkBtPGg1nREnSlVB8yrQx4aivtaJa1cyh99VqGcRJpvtyIwH3Dv1pfY
6O34J29O0EYgB6y01ZKkXGJJXeHym+tUdPfGsjebbI0C9jQVMks2RO3jCAoq4vxf2mj7
1u6w==
X-Gm-Message-State: AO0yUKVDt2zoqh9vkDEl1cdLz34I5dNVs9CXcm2RfAod25OqjxIEv6us
2b8ENAQ6BPH5YiQ+0P+GZdDC/i7CXBZSGhKuPDPQ28vQ6AU=
X-Google-Smtp-Source: AK7set9glDISVL/+dsGuMD5L9rwScNIrITXwSe0dddf7UnLJOLCZUVx4qztiQeHGNd0BbF/VpRhOsOck+YNHAnSc2hM=
X-Received: by 2002:a05:6000:1a42:b0:2ca:554c:17b7 with SMTP id
t2-20020a0560001a4200b002ca554c17b7mr948271wry.5.1677814623964; Thu, 02 Mar
2023 19:37:03 -0800 (PST)
In-Reply-To: <86mt4uwqnv.fsf@williamsburg.bawden.org>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <https://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>
X-Mailman-Original-Message-ID: <CAO+295tv0wCO+qqqtLwPdhiox6Fz+AMRbhLJ_GTRy4MVkAqqAw@mail.gmail.com>
X-Mailman-Original-References: <CAO+295u7pkb+qpuqR4-FnX_+6A6_DEcUbKDrSJT88Exgx2Xf3w@mail.gmail.com>
<CAPTjJmqEU6r+s6Rt9x6xE6Kx_gm=YEf3MFwKMpZpkQihXUa+Jw@mail.gmail.com>
<0556af4d-279d-8bf0-973d-54ea5e30f764@wichmann.us>
<CAO+295uSGRp7LqQT=v2GiQ06ahzkEmZgqwmJX7UsJiW7H+6i2g@mail.gmail.com>
<mailman.2140.1677805635.20444.python-list@python.org>
<86mt4uwqnv.fsf@williamsburg.bawden.org>
 by: jose isaias cabrera - Fri, 3 Mar 2023 03:36 UTC

On Thu, Mar 2, 2023 at 9:56 PM Alan Bawden <alan@csail.mit.edu> wrote:
>
> jose isaias cabrera <jicman@gmail.com> writes:
>
> On Thu, Mar 2, 2023 at 2:38 PM Mats Wichmann <mats@wichmann.us> wrote:
>
> This re is a bit different than the one I am used. So, I am trying to match
> everything after 'pn=':
>
> import re
> s = "pm=jose pn=2017"
> m0 = r"pn=(.+)"
> r0 = re.compile(m0)
> s0 = r0.match(s)
> >>> print(s0)
> None
>
> Assuming that you were expecting to match "pn=2017", then you probably
> don't want the 'match' method. Read its documentation. Then read the
> documentation for the _other_ methods that a Pattern supports. Then you
> will be enlightened.

Yes. I need search. Thanks.

--

What if eternity is real? Where will you spend it? Hmmmm...

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor