Deutsch   English   Français   Italiano  
<mailman.22.1728737523.4695.python-list@python.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news.mixmin.net!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: Thomas Passin <list1@tompassin.net>
Newsgroups: comp.lang.python
Subject: Re: Correct syntax for pathological re.search()
Date: Sat, 12 Oct 2024 08:51:57 -0400
Lines: 36
Message-ID: <mailman.22.1728737523.4695.python-list@python.org>
References: <ve0o34$1nep4$1@dont-email.me>
 <MQaOO.3313338$EVn.2054758@fx04.ams4>
 <011301db1c22$5e7519c0$1b5f4d40$@gmail.com>
 <20241012105958.cbctekv7vustleha@hjp.at>
 <966b510d-9bd7-4472-a858-7e042d78461d@tompassin.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 3x6ilcxZmjUxqQAXABIwfQ2unQM89aY8yCGmgqIM4uLw==
Cancel-Lock: sha1:k/Y1eFcnHpf0LFqbEKnQYumck58= sha256:aqkwdXVuYQcD1BpJuGlRrDkvCXhtbivbZ9nFzvWaOQU=
Return-Path: <list1@tompassin.net>
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=tompassin.net header.i=@tompassin.net header.b=wucX86Vk;
 dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'debugging': 0.07;
 'string': 0.07; 'expression': 0.09; 'prints': 0.09; 'string,':
 0.09; 'user.': 0.09; 'utility': 0.09; 'that.': 0.15; 'avi': 0.16;
 'compiled': 0.16; 'expressions.': 0.16; 'gross': 0.16; 'holzer':
 0.16; 'machine,': 0.16; 'received:10.0.0': 0.16; 'received:64.90':
 0.16; 'received:64.90.62': 0.16; 'received:64.90.62.162': 0.16;
 'received:dreamhost.com': 0.16; 'something.': 0.16;
 'subject:syntax': 0.16; 'visualize': 0.16; 'wrote:': 0.16;
 'probably': 0.17; 'to:addr:python-list': 0.20; 'input': 0.21;
 'anything': 0.25; "isn't": 0.27; 'function': 0.27; 'header:User-
 Agent:1': 0.30; 'seem': 0.31; 'am,': 0.31; 'looked': 0.31;
 'module': 0.31; "doesn't": 0.32; 'assume': 0.32; 'python-list':
 0.32; 'received:10.0': 0.32; 'received:mailchannels.net': 0.32;
 'received:relay.mailchannels.net': 0.32; 'but': 0.32;
 'subject:for': 0.33; 'there': 0.33; 'mean': 0.34; 'header:In-
 Reply-To:1': 0.34; 'display': 0.36; 'those': 0.36; "it's": 0.37;
 'way': 0.38; 'could': 0.38; 'use': 0.39; 'received:100': 0.39;
 'table': 0.39; 'skip:r 20': 0.64; 'clear': 0.64; 'produce': 0.65;
 'look': 0.65; 'header:Received:6': 0.67; 'received:64': 0.67;
 'site': 0.70; 'transitions': 0.84; 'websites': 0.95
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1728737517; a=rsa-sha256;
 cv=none;
 b=JAlVajETMqdTxOdQGFqHtLPNPxmsLc4rr31MwC9Tsck+gm+ZwLx0wzNvE5l6Nc1UyC+kl6
 mInG+3U/spFvINw9MsbL6UOMz/S5XC/xEdpbSPJT5ZoOTeADBzeqq7qm8DKP+/5N1MKiXP
 z681wTcKO8gEMxiyIlvQvoNdU9BiRWCcTz79NV22ytiDHyqCKezsALK7+wCCuOlsLw/ZB7
 Oh4udbPKEyeYifzJ9i6Nx6o+xqbxuVRNQjL8rs+s6DPVU1Fz13rRX79s4ILXTTckJicFZu
 /cykqPwoG3pxKCnPqWFqEh7TB54qBAwZKhaOwTJYuPNwaxSNmusmgiFA5TAJTw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
 d=mailchannels.net; s=arc-2022; t=1728737517;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references:dkim-signature;
 bh=MBwKbbVA/QwFSNxV09J8J3rc+RPaJXdCmQSLLNvQrIk=;
 b=1drTpMSG71Eu/r2MtpfFGniefQ+9uYdVT1OJblUN99bhVwuoBAUrhKRcvAU6HL/6vF1WtD
 5PDpCpyfWmgdi/HcD9hIi43mTAZjShOfqgxW04Rr3mTuzWviS10fVAdc2igfOlaC+a6ne2
 ldhS04UQiFoDoNvVeIiN4qQ5B+zY9YYCjfbKVIOUO21UK2EM4HRAKjD4V4AQ9rOHje9fB9
 U60MtIaJCkss9sMgV0FnEFsxbn4C5Z0GatAggSM1ZzW5m9KxIWXA8h4kEgBmwuNVhWiufT
 /QouyNAd2NBJrRVFqXA1X8qjCDOLe2hE2g4kbS/t4z2fBqnhQq9jZ0sQ2txZ6Q==
ARC-Authentication-Results: i=1; rspamd-6b8cf4b767-jr9ql;
 auth=pass smtp.auth=dreamhost smtp.mailfrom=list1@tompassin.net
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|tpassin@tompassin.net
X-MailChannels-Auth-Id: dreamhost
X-Shade-Whispering: 7dd0a2ad3028fa42_1728737518010_2991154234
X-MC-Loop-Signature: 1728737518010:1093906956
X-MC-Ingress-Time: 1728737518010
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net;
 s=dreamhost; t=1728737517;
 bh=MBwKbbVA/QwFSNxV09J8J3rc+RPaJXdCmQSLLNvQrIk=;
 h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding;
 b=wucX86VkRR+1alxFI5Ebyq/rfy4spsWcbSYRroEnkUSAoAWmqUFBnoo3QdAlnuyVx
 tHj+1w1ys1xXuSaxMsq7CAlG08kkQV9I8smgTzXaQ0WGCyGe0n9jFOFLxB2JZ+ngc6
 oEWbujrruN5KBajNT047Chi36t03zClX3uem4kc4nO8bNfSm9+/qQfUkid07ty+J24
 vofz3rXTmqSU3YFzACsqb37wNGvSjJ5isMazAKRTgY3c8hS2pJpur36O/gLMeBT5/Y
 ciE/JD/6tfPj9GwuR9qouitBo/83VvTcrVfXV15+rDXOPTc3VBDCueetrmFjpJ/VEZ
 HZ0tQWvIMWjYA==
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <20241012105958.cbctekv7vustleha@hjp.at>
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: <966b510d-9bd7-4472-a858-7e042d78461d@tompassin.net>
X-Mailman-Original-References: <ve0o34$1nep4$1@dont-email.me>
 <MQaOO.3313338$EVn.2054758@fx04.ams4>
 <011301db1c22$5e7519c0$1b5f4d40$@gmail.com>
 <20241012105958.cbctekv7vustleha@hjp.at>
Bytes: 7203

On 10/12/2024 6:59 AM, Peter J. Holzer via Python-list wrote:
> On 2024-10-11 17:13:07 -0400, AVI GROSS via Python-list wrote:
>> Is there some utility function out there that can be called to show what the
>> regular expression you typed in will look like by the time it is ready to be
>> used?
> 
> I assume that by "ready to be used" you mean the compiled form?
> 
> No, there doesn't seem to be a way to dump that. You can
> 
>      p = re.compile("\\\\sout{")
>      print(p.pattern)
> 
> but that just prints the input string, which you could do without
> compiling it first.

It prints the escaped version, so you can see if you escaped the string 
as you intended. In this case, the print will display '\\sout{'.  That's 
worth something.

> 
> But - without having looked at the implementation - it's far from clear
> that the compiled form would be useful to the user. It's probably some
> kind of state machine, and a large table of state transitions isn't very
> readable.
> 
> There are a number of websites which visualize regular expressions.
> Those are probably better for debugging a regular expression than
> anything the re module could reasonably produce (although with the
> caveat that such a web site would use a different implementation and
> therefore might produce different results).
> 
>          hp
> 
>