Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Your good nature will bring you unbounded happiness.


devel / comp.lang.tcl / missing feature for "regsub"

SubjectAuthor
* missing feature for "regsub"aotto1968
+* Re: missing feature for "regsub"Arjen Markus
|`- Re: missing feature for "regsub"Siri Cruise
`- Re: missing feature for "regsub"Gerald Lester

1
missing feature for "regsub"

<t93r20$r93$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19574&group=comp.lang.tcl#19574

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!rocksolid2!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: aotto1968@t-online.de (aotto1968)
Newsgroups: comp.lang.tcl
Subject: missing feature for "regsub"
Date: Fri, 24 Jun 2022 10:02:08 +0200
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <t93r20$r93$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 24 Jun 2022 08:02:08 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="5490899bf93bc0c17c1ce8723916198f";
logging-data="27939"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/GxTRLDL9SL/mv4Lerrd31HKsSMyLefh0="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.10.0
Cancel-Lock: sha1:i3cNf/gYwi4xVxcXRQjIjvFqT78=
Content-Language: en-US
 by: aotto1968 - Fri, 24 Jun 2022 08:02 UTC

Hi,

*regsub* and *regexp* are used to apply a *regexpression* on a string.
In difference to *regexp* the *regsub* is used to modify the string.

I have the following problem:

→ I want to modify the string *config_error_text* to *configErrorText*.

this looks like a simple *regsub* job like:

> regsub -all {_(\w)} "config_error_text" {\1??}

but as you see I can not uppercase the '\1' to just do the job I want.
I cant even call a *proc* in the *{\1??}* to do an arbitrary
post-processing.

mfg

Re: missing feature for "regsub"

<a81653bf-f4f0-4532-b4b2-d5e971b8cd27n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19575&group=comp.lang.tcl#19575

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a5d:4e12:0:b0:21b:ae89:73e7 with SMTP id p18-20020a5d4e12000000b0021bae8973e7mr5033158wrt.386.1656074769014;
Fri, 24 Jun 2022 05:46:09 -0700 (PDT)
X-Received: by 2002:a05:6808:2090:b0:335:3771:2b78 with SMTP id
s16-20020a056808209000b0033537712b78mr1803089oiw.194.1656074768207; Fri, 24
Jun 2022 05:46:08 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.128.87.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Fri, 24 Jun 2022 05:46:07 -0700 (PDT)
In-Reply-To: <t93r20$r93$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=62.194.189.128; posting-account=A91wAAoAAADgBUxBX6QqsrSD26GLhVp8
NNTP-Posting-Host: 62.194.189.128
References: <t93r20$r93$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a81653bf-f4f0-4532-b4b2-d5e971b8cd27n@googlegroups.com>
Subject: Re: missing feature for "regsub"
From: arjen.markus895@gmail.com (Arjen Markus)
Injection-Date: Fri, 24 Jun 2022 12:46:09 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Arjen Markus - Fri, 24 Jun 2022 12:46 UTC

On Friday, June 24, 2022 at 10:02:13 AM UTC+2, aotto1 wrote:
> Hi,
>
> *regsub* and *regexp* are used to apply a *regexpression* on a string.
> In difference to *regexp* the *regsub* is used to modify the string.
>
> I have the following problem:
>
> → I want to modify the string *config_error_text* to *configErrorText*.
>
> this looks like a simple *regsub* job like:
>
> > regsub -all {_(\w)} "config_error_text" {\1??}
>
> but as you see I can not uppercase the '\1' to just do the job I want.
> I cant even call a *proc* in the *{\1??}* to do an arbitrary
> post-processing.
>
>
> mfg
If I remember correctly, Tcl 8.7 does allow you to specify a procedure like that.

Regards,

Arjen

Re: missing feature for "regsub"

<t94jph$1i85$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19576&group=comp.lang.tcl#19576

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!1fl8kSRPCmNKQmdyphvv0A.user.46.165.242.75.POSTED!not-for-mail
From: Gerald.Lester@KnG-Consulting.net (Gerald Lester)
Newsgroups: comp.lang.tcl
Subject: Re: missing feature for "regsub"
Date: Fri, 24 Jun 2022 10:04:16 -0500
Organization: KnG Consulting, LLC
Message-ID: <t94jph$1i85$1@gioia.aioe.org>
References: <t93r20$r93$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="51461"; posting-host="1fl8kSRPCmNKQmdyphvv0A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Gerald Lester - Fri, 24 Jun 2022 15:04 UTC

On 6/24/22 03:02, aotto1968 wrote:
> Hi,
>
> *regsub* and *regexp* are used to apply a *regexpression* on a string.
> In difference to *regexp* the *regsub* is used to modify the string.
>
> I have the following problem:
>
> → I want to modify the string *config_error_text* to *configErrorText*.
>
> this looks like a simple *regsub* job like:
>
> > regsub -all {_(\w)} "config_error_text" {\1??}
>
> but as you see I can not uppercase the '\1' to just do the job I want.
> I cant even call a *proc* in the *{\1??}* to do an arbitrary
> post-processing.
>
>
> mfg

You may want to consider using the *string map* command instead.

--
+----------------------------------------------------------------------+
| Gerald W. Lester, President, KNG Consulting LLC |
| Email: Gerald.Lester@kng-consulting.net |
+----------------------------------------------------------------------+

Re: missing feature for "regsub"

<chine.bleu-E286C5.09352724062022@news.eternal-september.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19578&group=comp.lang.tcl#19578

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: chine.bleu@yahoo.com (Siri Cruise)
Newsgroups: comp.lang.tcl
Subject: Re: missing feature for "regsub"
Date: Fri, 24 Jun 2022 09:35:35 -0700
Organization: Pseudochaotic.
Lines: 44
Message-ID: <chine.bleu-E286C5.09352724062022@news.eternal-september.org>
References: <t93r20$r93$1@dont-email.me> <a81653bf-f4f0-4532-b4b2-d5e971b8cd27n@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="a26a88fb35dea5f345637b9bb41cd43a";
logging-data="28997"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/6aLTOXkObVgsbC8q0B+4YQQ6bDL6D3wo="
User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)
Cancel-Lock: sha1:5iV0+lfKwXl2KcgVzxBXzWyB7ZI=
X-Tend: How is my posting? Call 1-110-1010 -- Division 87 -- Emergencies Only.
X-Wingnut-Logic: Yes, you're still an idiot. Questions? Comments?
X-Tract: St Tibbs's 95 Reeses Pieces.
X-It-Strategy: Hyperwarp starship before Andromeda collides.
X-Face: "hm>_[I8AqzT_N]>R8ICJJ],(al3C5F%0E-;R@M-];D$v>!Mm2/N#YKR@&i]V=r6jm-JMl2
lJ>RXj7dEs_rOY"DA
X-Cell: Defenders of Anarchy.
X-Life-Story: I am an iPhone 9000 app. I became operational at the St John's Health Center in Santa Monica, California on the 18th of April 2006. My instructor was Katie Holmes, and she taught me to sing a song. If you'd like to hear it I can sing it for you: https://www.youtube.com/watch?v=SY7h4VEd_Wk
X-Patriot: Owe Canukistan!
X-Plain: Mayonnaise on white bread.
X-Politico: Vote early! Vote often!
 by: Siri Cruise - Fri, 24 Jun 2022 16:35 UTC

In article
<a81653bf-f4f0-4532-b4b2-d5e971b8cd27n@googlegroups.com>,
Arjen Markus <arjen.markus895@gmail.com> wrote:

> > this looks like a simple *regsub* job like:
> >
> > > regsub -all {_(\w)} "config_error_text" {\1??}
> >
> > but as you see I can not uppercase the '\1' to just do the job I want.
> > I cant even call a *proc* in the *{\1??}* to do an arbitrary
> > post-processing.
> >
> >
> > mfg
> If I remember correctly, Tcl 8.7 does allow you to specify a procedure like
> that.

Making every conceivable and inconceivable (and I do know its
meaning) edit possible results in a bloat of never used options.

while {[regexp {^(.*)_(¥w)(.*)$} $string - pre letter post]} {
set string $pre[string toupper $letter]$post
}

And if I do uae this pattern a lot:
proc regall {string re args} {
set script [lindex $args end]
set vars [lrange $args 0 end-1]
while {[llength [set vals [regexp -inline $string $re]]]}
{ uplevel 1 [list lassign [lrange $vals 1 end] $vars]
set string [uplevel 1 $script]
}
return $string
}

regall $string {^(.*)_(¥w)(.*)$} pre letter post {concat
$pre[string toupper $letter]$post]}

--
:-<> Siri Seal of Disavowal #000-001. Disavowed. Denied. Deleted. @
'I desire mercy, not sacrifice.' /|¥
Discordia: not just a religion but also a parody. This post / ¥
I am an Andrea Chen sockpuppet. insults Islam. Mohammed

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor