Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"Money is the root of all money." -- the moving finger


devel / comp.lang.tcl / Re: A regexp question

SubjectAuthor
* A regexp questionHelmut Giese
`* Re: A regexp questionChristian Gollwitzer
 `- Re: A regexp questionHelmut Giese

1
A regexp question

<qbvdjhdpo33fdh64uqa2s6gnckm3cr6ah7@4ax.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: hgiese@ratiosoft.com (Helmut Giese)
Newsgroups: comp.lang.tcl
Subject: A regexp question
Date: Fri, 30 Sep 2022 16:42:11 +0200
Organization: ratiosoft
Lines: 17
Message-ID: <qbvdjhdpo33fdh64uqa2s6gnckm3cr6ah7@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="dd471a83dd9141a2e7b085e08c11870b";
logging-data="1095271"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+IJEf2PQuhza3ZuF/3bdKW"
Cancel-Lock: sha1:q8irVhw0wEHg0+2lSkWQF8cQD8M=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)
 by: Helmut Giese - Fri, 30 Sep 2022 14:42 UTC

Hello out there,
I know that I am not a regexp guru but usually I get along and manage
somehow to reach what I am after. But the example below leaves me
stunned:
---
set line { | {NUMBER} {return [mkLeaf NUMBER $1]}}
set patt {|\s+{(.+)}\s+\{}
regexp $patt $line -> lhs ;# this returns '1'
set -> ;# this is empty
set lhs ;# as is this
---
How can this be? 'regexp' returning '1' but the matchvar(s) are empty?
This comes as a complete blow to my understanding of 'regexp'.
A very confused
Helmut
PS: This is on Windows with Tcl 8.6.10

Re: A regexp question

<th71ac$11kpg$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: auriocus@gmx.de (Christian Gollwitzer)
Newsgroups: comp.lang.tcl
Subject: Re: A regexp question
Date: Fri, 30 Sep 2022 17:13:08 +0200
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <th71ac$11kpg$1@dont-email.me>
References: <qbvdjhdpo33fdh64uqa2s6gnckm3cr6ah7@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 30 Sep 2022 15:17:32 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="6bc81342f0e049791f45147c815f9e2c";
logging-data="1102640"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XZzk+sw+c3RHfJNKir7n6dK9Iqo67XZQ="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:91.0)
Gecko/20100101 Thunderbird/91.13.0
Cancel-Lock: sha1:+XFHV9MVkP4OVl88vFhzV9I+csE=
In-Reply-To: <qbvdjhdpo33fdh64uqa2s6gnckm3cr6ah7@4ax.com>
 by: Christian Gollwitzer - Fri, 30 Sep 2022 15:13 UTC

Am 30.09.22 um 16:42 schrieb Helmut Giese:
> set line { | {NUMBER} {return [mkLeaf NUMBER $1]}}
> set patt {|\s+{(.+)}\s+\{}
> regexp $patt $line -> lhs

The | is a regexp metacharacter for branching. The regexp matches the
empty string at the beginning of your line:

(chris) 58 % regexp $patt ""
1

Christian

Re: A regexp question

<h96ejhtiv87siu9harn9ul5m6ui1jmss6f@4ax.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: hgiese@ratiosoft.com (Helmut Giese)
Newsgroups: comp.lang.tcl
Subject: Re: A regexp question
Date: Fri, 30 Sep 2022 18:33:48 +0200
Organization: ratiosoft
Lines: 20
Message-ID: <h96ejhtiv87siu9harn9ul5m6ui1jmss6f@4ax.com>
References: <qbvdjhdpo33fdh64uqa2s6gnckm3cr6ah7@4ax.com> <th71ac$11kpg$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="dd471a83dd9141a2e7b085e08c11870b";
logging-data="1118309"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+b7/sv+yfHVwdgWVBF0Fhc"
Cancel-Lock: sha1:OhnuKVsUsnOsKFu6nmFuruc37lw=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)
 by: Helmut Giese - Fri, 30 Sep 2022 16:33 UTC

Christian Gollwitzer <auriocus@gmx.de> schrieb:

>Am 30.09.22 um 16:42 schrieb Helmut Giese:
>> set line { | {NUMBER} {return [mkLeaf NUMBER $1]}}
>> set patt {|\s+{(.+)}\s+\{}
>> regexp $patt $line -> lhs
>
>The | is a regexp metacharacter for branching. The regexp matches the
>empty string at the beginning of your line:
>
>(chris) 58 % regexp $patt ""
>1
>
> Christian
Thanks Christian,
I didn't know that. I must have read it, some time in the past, but
have, I believe, never used it and so it didn't stick.
Phew, I am really relieved.
Thanks again and have a nice weekend
Helmut


devel / comp.lang.tcl / Re: A regexp question

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor