Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"If you are afraid of loneliness, don't marry." -- Chekhov


devel / comp.lang.tcl / Re: I think this is an "regsub" error

SubjectAuthor
* I think this is an "regsub" erroraotto1968
`* Re: I think this is an "regsub" errorGerald Lester
 `* Re: I think this is an "regsub" erroraotto1968
  +- Re: I think this is an "regsub" errorGerald Lester
  `* Re: I think this is an "regsub" errorEric
   `* Re: I think this is an "regsub" erroraotto1968
    +* Re: I think this is an "regsub" errorLuc
    |`* Re: I think this is an "regsub" erroraotto1968
    | +- Re: I think this is an "regsub" errorLuc
    | `- Re: I think this is an "regsub" errorGerald Lester
    `- Re: I think this is an "regsub" errorAndreas Leitgeb

1
I think this is an "regsub" error

<uu8f1j$s5ka$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13588&group=comp.lang.tcl#13588

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: I think this is an "regsub" error
Date: Sat, 30 Mar 2024 08:29:55 +0100
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <uu8f1j$s5ka$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 30 Mar 2024 07:29:55 +0100 (CET)
Injection-Info: dont-email.me; posting-host="e518c6a270a5c1e87e98cd696cd234e5";
logging-data="923274"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MMRNB3ADIQ20N63OC6IeMQNlJDhxIguo="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:q+2GDsHYvz4VA2oyf4Fxj7OMRUw=
Content-Language: en-US
 by: aotto1968 - Sat, 30 Mar 2024 07:29 UTC

Hi,

small example…

> set a 111222333
> regsub {2+} $a {\1kk}

-> 111kk333

the *regsub* does not complain about *non* defined '\1', the *sed* raise an error

> LANG=C sed -i -E 's/'\''\$\(\w+_CPPFLAGS\)'\''/'\''@\1@'\''/g' theConfig/ccmsgque/Makefile.am
> sed: -e expression #1, char 31: invalid reference \1 on `s' command's RHS

background → if you explicit define an '\1' you assume that an '(...)' is available.
if NOT this is mostly an error.

mfg ao

Re: I think this is an "regsub" error

<WnVNN.586210$PuZ9.292101@fx11.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13589&group=comp.lang.tcl#13589

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!news.swapon.de!news.mixmin.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!193.141.40.65.MISMATCH!npeer.as286.net!npeer-ng0.as286.net!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx11.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: I think this is an "regsub" error
Content-Language: en-US
Newsgroups: comp.lang.tcl
References: <uu8f1j$s5ka$1@dont-email.me>
From: Gerald.Lester@gmail.com (Gerald Lester)
In-Reply-To: <uu8f1j$s5ka$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 27
Message-ID: <WnVNN.586210$PuZ9.292101@fx11.iad>
X-Complaints-To: abuse@fastusenet.org
NNTP-Posting-Date: Sat, 30 Mar 2024 14:32:22 UTC
Organization: fastusenet - www.fastusenet.org
Date: Sat, 30 Mar 2024 09:32:22 -0500
X-Received-Bytes: 1427
 by: Gerald Lester - Sat, 30 Mar 2024 14:32 UTC

On 3/30/24 02:29, aotto1968 wrote:
> Hi,
>
> small example…
>
> > set a 111222333
> > regsub {2+} $a {\1kk}
>
> -> 111kk333
>
> the *regsub* does not complain about *non* defined '\1', the *sed* raise
> an error
>
> > LANG=C sed -i -E 's/'\''\$\(\w+_CPPFLAGS\)'\''/'\''@\1@'\''/g'
> theConfig/ccmsgque/Makefile.am
> > sed: -e expression #1, char 31: invalid reference \1 on `s' command's
> RHS
>
> background → if you explicit define an '\1' you assume that an '(...)'
> is available.
> if NOT this is mostly an error.

Ah, the man page does not say that. regsub is not sed.

The \1 ... \9 are the empty string if not matched.

Re: I think this is an "regsub" error

<uubhar$1oooh$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13591&group=comp.lang.tcl#13591

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: Re: I think this is an "regsub" error
Date: Sun, 31 Mar 2024 13:27:23 +0200
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <uubhar$1oooh$1@dont-email.me>
References: <uu8f1j$s5ka$1@dont-email.me> <WnVNN.586210$PuZ9.292101@fx11.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 31 Mar 2024 11:27:23 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="027a585dce4d0a86d258d90a48193205";
logging-data="1860369"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/lYK/B14Tc3GY8wTAz/eaj0fHuEXkjbUk="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:9gFK0KPYAXhmZQ75uR/aE8vA/3Q=
Content-Language: en-US
In-Reply-To: <WnVNN.586210$PuZ9.292101@fx11.iad>
 by: aotto1968 - Sun, 31 Mar 2024 11:27 UTC

On 30.03.24 15:32, Gerald Lester wrote:
> On 3/30/24 02:29, aotto1968 wrote:
>> Hi,
>>
>> small example…
>>
>>  > set a 111222333
>>  > regsub {2+} $a {\1kk}
>>
>> -> 111kk333
>>
>> the *regsub* does not complain about *non* defined '\1', the *sed* raise an error
>>
>>  > LANG=C sed -i -E 's/'\''\$\(\w+_CPPFLAGS\)'\''/'\''@\1@'\''/g' theConfig/ccmsgque/Makefile.am
>>  > sed: -e expression #1, char 31: invalid reference \1 on `s' command's RHS
>>
>> background → if you explicit define an '\1' you assume that an '(...)' is available.
>> if NOT this is mostly an error.
>
> Ah, the man page does not say that.  regsub is not sed.
>
> The \1 ... \9 are the empty string if not matched.
>
>

→ yes, make a BUG to a FEATURE and you are fine.

I already had some "problems" because of this BUG because it is *IMPOSSIBLE* to check the
regular expression of the *regsub* to be *valid* again a target replacement.

I understand that you already have code that depends on this BUG but with a "-strict" switch
you have a chance to fix this BUG.

mfg

Re: I think this is an "regsub" error

<9gdON.177713$zF_1.117519@fx18.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13592&group=comp.lang.tcl#13592

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!npeer.as286.net!npeer-ng0.as286.net!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: I think this is an "regsub" error
Content-Language: en-US
Newsgroups: comp.lang.tcl
References: <uu8f1j$s5ka$1@dont-email.me> <WnVNN.586210$PuZ9.292101@fx11.iad>
<uubhar$1oooh$1@dont-email.me>
From: Gerald.Lester@gmail.com (Gerald Lester)
In-Reply-To: <uubhar$1oooh$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 44
Message-ID: <9gdON.177713$zF_1.117519@fx18.iad>
X-Complaints-To: abuse@fastusenet.org
NNTP-Posting-Date: Sun, 31 Mar 2024 13:09:25 UTC
Organization: fastusenet - www.fastusenet.org
Date: Sun, 31 Mar 2024 08:09:25 -0500
X-Received-Bytes: 2101
 by: Gerald Lester - Sun, 31 Mar 2024 13:09 UTC

On 3/31/24 06:27, aotto1968 wrote:
> On 30.03.24 15:32, Gerald Lester wrote:
>> On 3/30/24 02:29, aotto1968 wrote:
>>> Hi,
>>>
>>> small example…
>>>
>>>  > set a 111222333
>>>  > regsub {2+} $a {\1kk}
>>>
>>> -> 111kk333
>>>
>>> the *regsub* does not complain about *non* defined '\1', the *sed*
>>> raise an error
>>>
>>>  > LANG=C sed -i -E 's/'\''\$\(\w+_CPPFLAGS\)'\''/'\''@\1@'\''/g'
>>> theConfig/ccmsgque/Makefile.am
>>>  > sed: -e expression #1, char 31: invalid reference \1 on `s'
>>> command's RHS
>>>
>>> background → if you explicit define an '\1' you assume that an
>>> '(...)' is available.
>>> if NOT this is mostly an error.
>>
>> Ah, the man page does not say that.  regsub is not sed.
>>
>> The \1 ... \9 are the empty string if not matched.
>>
>>
>
> → yes, make a BUG to a FEATURE and you are fine.
>
> I already had some "problems" because of this BUG because it is
> *IMPOSSIBLE* to check the
> regular expression of the *regsub* to be *valid* again a target
> replacement.
>
> I understand that you already have code that depends on this BUG but
> with a "-strict" switch
> you have a chance to fix this BUG.

Please submit a TIP for adding a strict switch with a sample
implementation.

Re: I think this is an "regsub" error

<slrnv0in05.p7e.eric@bruno.deptj.eu>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13593&group=comp.lang.tcl#13593

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!193.141.40.65.MISMATCH!npeer.as286.net!npeer-ng0.as286.net!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx05.ams4.POSTED!not-for-mail
Newsgroups: comp.lang.tcl
From: eric@deptj.eu (Eric)
Subject: Re: I think this is an "regsub" error
References: <uu8f1j$s5ka$1@dont-email.me>
<WnVNN.586210$PuZ9.292101@fx11.iad> <uubhar$1oooh$1@dont-email.me>
User-Agent: slrn/1.0.3 (Linux)
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Message-ID: <slrnv0in05.p7e.eric@bruno.deptj.eu>
Lines: 30
X-Complaints-To: abuse@eweka.nl
NNTP-Posting-Date: Sun, 31 Mar 2024 13:10:07 UTC
Organization: Eweka Internet Services
Date: Sun, 31 Mar 2024 14:50:13 +0200
X-Received-Bytes: 1609
 by: Eric - Sun, 31 Mar 2024 12:50 UTC

On 2024-03-31, aotto1968 <aotto1968@t-online.de> wrote:
> On 30.03.24 15:32, Gerald Lester wrote:
8>< --------
>>
>> Ah, the man page does not say that.  regsub is not sed.
>>
>> The \1 ... \9 are the empty string if not matched.
>>
>>
>
> → yes, make a BUG to a FEATURE and you are fine.
>
> I already had some "problems" because of this BUG because it is
> *IMPOSSIBLE* to check the regular expression of the *regsub* to be *valid*
> again a target replacement.
>
> I understand that you already have code that depends on this BUG but
> with a "-strict" switch you have a chance to fix this BUG.
>
> mfg

It behaves as documented, so it's not a bug. It's always (as far as I
know) behaved like that, so you are requesting a change - write a TIP !

But I for one would be interested in seeing an example of your
*IMPOSSIBLE* validation.

Eric
--
ms fnd in a lbry

Re: I think this is an "regsub" error

<uuc9k6$1ucgf$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13595&group=comp.lang.tcl#13595

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: Re: I think this is an "regsub" error
Date: Sun, 31 Mar 2024 20:21:58 +0200
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <uuc9k6$1ucgf$1@dont-email.me>
References: <uu8f1j$s5ka$1@dont-email.me> <WnVNN.586210$PuZ9.292101@fx11.iad>
<uubhar$1oooh$1@dont-email.me> <slrnv0in05.p7e.eric@bruno.deptj.eu>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 31 Mar 2024 18:21:58 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="027a585dce4d0a86d258d90a48193205";
logging-data="2044431"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+k3hDV1qLmOkC/iah9YhYfoM+pJmGKQmE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Z+onkvDDHMTlltpTHiiJKfHSqcU=
In-Reply-To: <slrnv0in05.p7e.eric@bruno.deptj.eu>
Content-Language: en-US
 by: aotto1968 - Sun, 31 Mar 2024 18:21 UTC

On 31.03.24 14:50, Eric wrote:
> On 2024-03-31, aotto1968 <aotto1968@t-online.de> wrote:
>> On 30.03.24 15:32, Gerald Lester wrote:

>
> It behaves as documented, so it's not a bug. It's always (as far as I
> know) behaved like that, so you are requesting a change - write a TIP !
>
> But I for one would be interested in seeing an example of your
> *IMPOSSIBLE* validation.
>
> Eric

As I already show in the initial post that *sed* is doing such kind of test.
With *IMPOSSIPLE* I mean to check a regular expression in *tcl* is close to *IMPOSSIPLE*.
the *-strict* switch is just an example how to fix this BUG without break *old* code.

just my initial background:

I have a tool called *change.tcl* which read a file and do string/regxp replacement.

the usage is simple: change.tcl -r "from-regexp" "to-something" file...

if the "from-regexp" does not match with "to-something" because of the BUG from above
you end up with "broken" files.

Re: I think this is an "regsub" error

<20240331154748.73562e67@lud1.home>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13596&group=comp.lang.tcl#13596

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: I think this is an "regsub" error
Date: Sun, 31 Mar 2024 15:47:48 -0300
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <20240331154748.73562e67@lud1.home>
References: <uu8f1j$s5ka$1@dont-email.me>
<WnVNN.586210$PuZ9.292101@fx11.iad>
<uubhar$1oooh$1@dont-email.me>
<slrnv0in05.p7e.eric@bruno.deptj.eu>
<uuc9k6$1ucgf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 31 Mar 2024 18:47:49 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="49e6c714c39a8397a9312cebf412aadf";
logging-data="2055763"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qi1a5FPhdOl9v2QZ0n+RRFRqudHkHTzw="
Cancel-Lock: sha1:sHW30wW06EgNy59x16/8HxHyB+E=
 by: Luc - Sun, 31 Mar 2024 18:47 UTC

On Sun, 31 Mar 2024 20:21:58 +0200, aotto1968 wrote:

>As I already show in the initial post that *sed* is doing such kind of
>test. With *IMPOSSIPLE* I mean to check a regular expression in *tcl* is
>close to *IMPOSSIPLE*. the *-strict* switch is just an example how to fix
>this BUG without break *old* code.
**************************

I see your point, you do have a point, but it's not impossible.

% set a 111222333
111222333
% regexp {2+} $a -> found1
1 % info exists found1
1 % set found1
<-- empty string
% regexp {(2+)} $a -> found1
1 % set found1
222

So you can always check if something was stored in found1, found2,
found3... etc. There is your safety check. It's only going to cost you
two additional lines.

--
Luc
>>

Re: I think this is an "regsub" error

<slrnv0jm38.a0i.avl@logic.at>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13599&group=comp.lang.tcl#13599

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: avl@logic.at (Andreas Leitgeb)
Newsgroups: comp.lang.tcl
Subject: Re: I think this is an "regsub" error
Date: Sun, 31 Mar 2024 21:40:56 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <slrnv0jm38.a0i.avl@logic.at>
References: <uu8f1j$s5ka$1@dont-email.me>
<WnVNN.586210$PuZ9.292101@fx11.iad> <uubhar$1oooh$1@dont-email.me>
<slrnv0in05.p7e.eric@bruno.deptj.eu> <uuc9k6$1ucgf$1@dont-email.me>
Reply-To: avl@logic.at
Injection-Date: Sun, 31 Mar 2024 21:40:56 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ee83a00805eee71b0c568737a5a3c2ae";
logging-data="2125844"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VxNaCnX1d8SvQqia+Lh8c"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:5UDZHRkALmiSEplDtgMZ1FSKvBo=
 by: Andreas Leitgeb - Sun, 31 Mar 2024 21:40 UTC

aotto1968 <aotto1968@t-online.de> wrote:
> With *IMPOSSIPLE* I mean to check a regular expression in *tcl* is
> close to *IMPOSSIPLE*.

Do you know about [regexp -about $RE] ?

First element of its result is the number of subexpressions.
You could check the replacement-string for \\\d sequences that
have a larger digit than the number of subexpressions.

Apart from that, if your code uses an RE and replacement given
from the caller, then the caller alone is responsible for
their correctness... Afterall, if either is wrong, even
if right w.r.t backreferences, then the result file would
still be broken.

Re: I think this is an "regsub" error

<uudjhd$2b3qr$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13604&group=comp.lang.tcl#13604

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: Re: I think this is an "regsub" error
Date: Mon, 1 Apr 2024 08:17:17 +0200
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <uudjhd$2b3qr$1@dont-email.me>
References: <uu8f1j$s5ka$1@dont-email.me> <WnVNN.586210$PuZ9.292101@fx11.iad>
<uubhar$1oooh$1@dont-email.me> <slrnv0in05.p7e.eric@bruno.deptj.eu>
<uuc9k6$1ucgf$1@dont-email.me> <20240331154748.73562e67@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 01 Apr 2024 06:17:17 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="db3b3df467521f6f0c23692629f47f57";
logging-data="2461531"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18G+TNb3Z77xZlTzMxR2/0DLcOGC3+9c8E="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:8ttEiYZ/4TLYlOaKpVI5HfYeGMg=
In-Reply-To: <20240331154748.73562e67@lud1.home>
Content-Language: en-US
 by: aotto1968 - Mon, 1 Apr 2024 06:17 UTC

On 31.03.24 20:47, Luc wrote:
> On Sun, 31 Mar 2024 20:21:58 +0200, aotto1968 wrote:
>
>> As I already show in the initial post that *sed* is doing such kind of
>> test. With *IMPOSSIPLE* I mean to check a regular expression in *tcl* is
>> close to *IMPOSSIPLE*. the *-strict* switch is just an example how to fix
>> this BUG without break *old* code.
> **************************
>
> I see your point, you do have a point, but it's not impossible.
>
> % set a 111222333
> 111222333
> % regexp {2+} $a -> found1
> 1
> % info exists found1
> 1
> % set found1
> <-- empty string
> % regexp {(2+)} $a -> found1
> 1
> % set found1
> 222
>
> So you can always check if something was stored in found1, found2,
> found3... etc. There is your safety check. It's only going to cost you
> two additional lines.
>

I use *regsub* and in *regsub* you have no place to add some testing code.

Re: I think this is an "regsub" error

<20240401144647.6af3c1fe@lud1.home>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13605&group=comp.lang.tcl#13605

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: I think this is an "regsub" error
Date: Mon, 1 Apr 2024 14:46:47 -0300
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <20240401144647.6af3c1fe@lud1.home>
References: <uu8f1j$s5ka$1@dont-email.me>
<WnVNN.586210$PuZ9.292101@fx11.iad>
<uubhar$1oooh$1@dont-email.me>
<slrnv0in05.p7e.eric@bruno.deptj.eu>
<uuc9k6$1ucgf$1@dont-email.me>
<20240331154748.73562e67@lud1.home>
<uudjhd$2b3qr$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 01 Apr 2024 17:46:48 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="2694b4930a244371d80d17f3175579a2";
logging-data="2766922"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19PIXJlLWn8rEANW9g44FYhdbvko744rzk="
Cancel-Lock: sha1:8posSIf98QZDsvvKYV1X1PQklRw=
 by: Luc - Mon, 1 Apr 2024 17:46 UTC

On Mon, 1 Apr 2024 08:17:17 +0200, aotto1968 wrote:

>I use *regsub* and in *regsub* you have no place to add some testing code.

You run the test with regexp immediately before you run regsub, in
case you still want to run the regsub depending on the result of the
test.

--
Luc
>>

Re: I think this is an "regsub" error

<hBCON.189395$taff.181401@fx41.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=13607&group=comp.lang.tcl#13607

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx41.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: I think this is an "regsub" error
Content-Language: en-US
Newsgroups: comp.lang.tcl
References: <uu8f1j$s5ka$1@dont-email.me> <WnVNN.586210$PuZ9.292101@fx11.iad>
<uubhar$1oooh$1@dont-email.me> <slrnv0in05.p7e.eric@bruno.deptj.eu>
<uuc9k6$1ucgf$1@dont-email.me> <20240331154748.73562e67@lud1.home>
<uudjhd$2b3qr$1@dont-email.me>
From: Gerald.Lester@gmail.com (Gerald Lester)
In-Reply-To: <uudjhd$2b3qr$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 38
Message-ID: <hBCON.189395$taff.181401@fx41.iad>
X-Complaints-To: abuse@fastusenet.org
NNTP-Posting-Date: Mon, 01 Apr 2024 17:58:37 UTC
Organization: fastusenet - www.fastusenet.org
Date: Mon, 1 Apr 2024 12:58:37 -0500
X-Received-Bytes: 2050
 by: Gerald Lester - Mon, 1 Apr 2024 17:58 UTC

On 4/1/24 01:17, aotto1968 wrote:
> On 31.03.24 20:47, Luc wrote:
>> On Sun, 31 Mar 2024 20:21:58 +0200, aotto1968 wrote:
>>
>>> As I already show in the initial post that *sed* is doing such kind of
>>> test. With *IMPOSSIPLE* I mean to check a regular expression in *tcl* is
>>> close to *IMPOSSIPLE*. the *-strict* switch is just an example how to
>>> fix
>>> this BUG without break *old* code.
>> **************************
>>
>> I see your point, you do have a point, but it's not impossible.
>>
>> % set a 111222333
>> 111222333
>> % regexp {2+} $a -> found1
>> 1
>> % info exists found1
>> 1
>> % set found1
>>        <-- empty string
>> % regexp {(2+)} $a -> found1
>> 1
>> % set found1
>> 222
>>
>> So you can always check if something was stored in found1, found2,
>> found3... etc. There is your safety check. It's only going to cost you
>> two additional lines.
>>
>
> I use *regsub* and in *regsub* you have no place to add some testing code.

Use the varname with regsub and place the substituted string in a temp
variable. Then check the return value of regsub to see if the count is
what you expected it to be.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor