Deutsch English Français Italiano |
<vbgflq$15f5c$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: p.dean@gmx.com (Peter Dean) Newsgroups: misc.test,comp.lang.misc Subject: Re: perl test Date: Sat, 7 Sep 2024 03:01:14 -0000 (UTC) Organization: A noiseless patient Spider Lines: 25 Sender: <peter@flo.localdomain> Message-ID: <vbgflq$15f5c$1@dont-email.me> References: <7e8b459c7297ad24dde92aa1fd073b21@www.novabbs.com> <877cbx4orz.fsf@tilde.institute> <51e8c77eaba5ea4084d0a234a71a4f2e@www.novabbs.com> <vbdoi9$m19l$1@dont-email.me> <7e23f0180a430b8429af2514ba56463b@www.novabbs.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sat, 07 Sep 2024 05:01:15 +0200 (CEST) Injection-Info: dont-email.me; posting-host="dcd945fd0f0ad96b43bf55fe8ad14c00"; logging-data="1227948"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+iau16sK0hWgGU9TENBcOx" User-Agent: tin/2.6.3-20231224 ("Banff") (Linux/6.6.49-1-lts (x86_64)) Cancel-Lock: sha1:MFgqQLCUb4TERT+nQUnG2htP3MM= Bytes: 1859 In comp.lang.misc Retro Guy <retroguy@novabbs.com> wrote: > On Fri, 6 Sep 2024 2:14:33 +0000, Lawrence D'Oliveiro wrote: > >> On Sat, 31 Aug 2024 12:33:39 +0000, Retro Guy wrote: >> >>> I figured out my Perl issue. =~ s/([\"])/\\$1/g; does the trick. >> >> If that Perl code does what I think it does, the following Python >> equivalent is simpler: >> >> «str-expr».replace('"', '""') > > The Perl code above escapes quotes, so adds '\' before any " > > I know nothing of Python :) > > I actually ended up with =~ s/([\$"])/\\$1/g; in my final code. I needed > to escape both quotes and '$' > would it hurt to backslash everything nonalphanumeric? perldoc -f quotemeta