Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <mailman.28.1729285790.4695.python-list@python.org>
Deutsch   English   Français   Italiano  
<mailman.28.1729285790.4695.python-list@python.org>

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

Path: ...!feeds.phibee-telecom.net!news.mixmin.net!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: "Peter J. Holzer" <hjp-python@hjp.at>
Newsgroups: comp.lang.python
Subject: Re: Correct syntax for pathological re.search()
Date: Fri, 18 Oct 2024 23:09:41 +0200
Lines: 78
Message-ID: <mailman.28.1729285790.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>
 <20241018210941.f5azh2lvz7cxzcy5@hjp.at>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
 protocol="application/pgp-signature"; boundary="jcuygm3ttbtxcbci"
X-Trace: news.uni-berlin.de El96d0tX4ZpIlY+NNS172wo1C/6KkkEHbT4n3QztnDFA==
Cancel-Lock: sha1:aak7i8DdYa0GPXjOhLCLstvCC1E= sha256:2babmzlSGIfHMh2Mf2d7xICgpengB1Z4x6AKBnPTTEA=
Return-Path: <hjp-python@hjp.at>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
 dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'content-
 type:multipart/signed': 0.05; 'string': 0.07; 'content-
 type:application/pgp-signature': 0.09; 'expression': 0.09;
 'filename:fname piece:asc': 0.09; 'filename:fname
 piece:signature': 0.09; 'filename:fname:signature.asc': 0.09;
 'prints': 0.09; 'string,': 0.09; 'trivial': 0.09; 'utility': 0.09;
 'that.': 0.15; '"creative': 0.16; '__/': 0.16; 'assert': 0.16;
 'avi': 0.16; 'challenge!"': 0.16; 'compiled': 0.16; 'expressions':
 0.16; 'from:addr:hjp-python': 0.16; 'from:addr:hjp.at': 0.16;
 'from:name:peter j. holzer': 0.16; 'gross': 0.16; 'hjp@hjp.at':
 0.16; 'holzer': 0.16; 'reality.': 0.16; 'stross,': 0.16;
 'subject:syntax': 0.16; 'url-ip:212.17.106/24': 0.16; 'url-
 ip:212.17/16': 0.16; 'url:hjp': 0.16; '|_|_)': 0.16; 'wrote:':
 0.16; 'to:addr:python-list': 0.20; 'input': 0.21; 'anything':
 0.25; 'seems': 0.26; 'function': 0.27; 'sense': 0.28; 'example,':
 0.28; 'seem': 0.31; 'am,': 0.31; "doesn't": 0.32; 'assume': 0.32;
 'python-list': 0.32; 'but': 0.32; 'subject:for': 0.33; 'there':
 0.33; "didn't": 0.34; 'mean': 0.34; 'header:In-Reply-To:1': 0.34;
 'display': 0.36; 'way': 0.38; 'could': 0.38; 'two': 0.39; 'valid':
 0.39; 'received:212': 0.62; 'between': 0.63; 'skip:r 20': 0.64;
 'look': 0.65; 'received:userid': 0.66; 'know.': 0.68; 'url-
 ip:212/8': 0.69; 'received:at': 0.84
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <966b510d-9bd7-4472-a858-7e042d78461d@tompassin.net>
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: <20241018210941.f5azh2lvz7cxzcy5@hjp.at>
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>
 <966b510d-9bd7-4472-a858-7e042d78461d@tompassin.net>
Bytes: 6488


--jcuygm3ttbtxcbci
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2024-10-12 08:51:57 -0400, Thomas Passin via Python-list wrote:
> 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 w=
hat the
> > > regular expression you typed in will look like by the time it is read=
y to be
> > > used?
> >=20
> > I assume that by "ready to be used" you mean the compiled form?
> >=20
> > No, there doesn't seem to be a way to dump that. You can
> >=20
> >      p =3D re.compile("\\\\sout{")
> >      print(p.pattern)
> >=20
> > but that just prints the input string, which you could do without
> > compiling it first.
>=20
> It prints the escaped version,

Did you mean the *un*escaped version? Well, yeah, that's what print
does.

> so you can see if you escaped the string as you intended. In this
> case, the print will display '\\sout{'.

print("\\\\sout{")
will do the same.

It seems to me that for any string s which is a valid regular expression
(i.e. re.compile doesn't throw an exception)

    assert re.compile(s).pattern =3D=3D s

holds.

So it doesn't give you anything you didn't already know.

As a trivial example, the regular expressions r"\\sout{" and r"\\sout\{"
are equivalent (the \ before the { is redundant). Yet
re.compile(s).pattern preserves the difference between the two strings.

        hp

--=20
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

--jcuygm3ttbtxcbci
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmcSzo0ACgkQ8g5IURL+
KF20bg//YkA5go+I97KeDcgF5HF/zFVmsfGJar8yPBWy9RLCmZDzjKx336GCKVbo
20N7AAXrgkTyh9uUOFaTp1J0uokntWjUPLSJKMGmfleLHYFJfbBFBDtt2HlGjCpV
O7QFqBH0NsmGIh3zh1ZXn4k+GUnChOJia3AeJTRJynlm4ISB5gHqp/UUj+5NSW8T
D8GFQW1b2qgzuU49paKuau2qun6j+Fk6gKNIoFGM1VsGQDuxnJ47nGFrB1ntcyH4
F72Ln4GQPEeEqWO8Zyo1lle29G11bxDJ9G73xrIrDj8YEdUm5wGkdwMlGBi8MiXR
PWvpoRC84K9lKGrcZKqgxu+BCUcz2AtPO1rNYduFSm6qh5kjpScAfwqdDTfiW8kf
nyjddWwq0i1FMjJ9YBJ0FQ5pQAJIvsHIZs+fPnB1cmJi1CnBjDCafBzbzT8W48AN
klcDwAOQJoci1GphWut5/NKuk/tbqY7CiEsYbs6sCi6omIo5fQG/rnweAkP004Ar
7vtJXgc/X/DJr29Zg4Kh88/1MJk9AkKgZGjpD0OYZVFN1cuMqJYzjYsK7L1DaGMP
aomO4/vX82pfvbs7IkUfK6LJYsHt+ww39iiBAAOiEwaCVH68oGPlfdLnYdpQEAqn
Ls1SMKu+UijM6ClZf6Krng9aIElAMYyC2Rr0qAApzVJmEPFXke4=
=JOFL
-----END PGP SIGNATURE-----

--jcuygm3ttbtxcbci--