Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

That wouldn't be good enough. -- Larry Wall in <199710131621.JAA14907@wall.org>


devel / comp.lang.tcl / Re: regexp to locate instances of a specific character when not enclosed in double quotes

SubjectAuthor
* regexp to locate instances of a specific character when not enclosedThe Rickster
`* regexp to locate instances of a specific character when notLuc
 `* regexp to locate instances of a specific character when notThe Rickster
  `* regexp to locate instances of a specific character when notheinrichmartin
   `* regexp to locate instances of a specific character when notThe Rickster
    `* regexp to locate instances of a specific character when notThe Rickster
     +- regexp to locate instances of a specific character when notHarald Oehlmann
     `* regexp to locate instances of a specific character when notheinrichmartin
      `- regexp to locate instances of a specific character when notLuc

1
regexp to locate instances of a specific character when not enclosed in double quotes

<945a6512-6687-40d9-b0d7-31fd95c6716fn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:ad4:5f0a:0:b0:4c2:301d:eb9a with SMTP id fo10-20020ad45f0a000000b004c2301deb9amr3313729qvb.74.1667584565965;
Fri, 04 Nov 2022 10:56:05 -0700 (PDT)
X-Received: by 2002:a05:622a:58b:b0:39c:fab9:3045 with SMTP id
c11-20020a05622a058b00b0039cfab93045mr30208638qtb.26.1667584565730; Fri, 04
Nov 2022 10:56:05 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Fri, 4 Nov 2022 10:56:05 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2603:8001:b500:c130:5008:1538:cdc3:7891;
posting-account=a7bcHgoAAADQ0akqIyRQmxfQdEEZtAt5
NNTP-Posting-Host: 2603:8001:b500:c130:5008:1538:cdc3:7891
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <945a6512-6687-40d9-b0d7-31fd95c6716fn@googlegroups.com>
Subject: regexp to locate instances of a specific character when not enclosed
in double quotes
From: sled99...@gmail.com (The Rickster)
Injection-Date: Fri, 04 Nov 2022 17:56:05 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1434
 by: The Rickster - Fri, 4 Nov 2022 17:56 UTC

given the string 'Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy Bob, Jr}

I am able to use regexp negative look ahead to locate all comma chars in positions not enclosed in braces.
,(?![^\{]*\})

However, an regular expression that identify locations of commas external to double quotes and braces would be appreciated.

Thanks

Re: regexp to locate instances of a specific character when not enclosed in double quotes

<20221104152948.55d5d04b@lud1.home>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!ygY8GGqbXOZkGZKslZ69Yw.user.46.165.242.75.POSTED!not-for-mail
From: no...@no.no (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: regexp to locate instances of a specific character when not
enclosed in double quotes
Date: Fri, 4 Nov 2022 15:29:48 -0300
Organization: Aioe.org NNTP Server
Message-ID: <20221104152948.55d5d04b@lud1.home>
References: <945a6512-6687-40d9-b0d7-31fd95c6716fn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="64323"; posting-host="ygY8GGqbXOZkGZKslZ69Yw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
X-Newsreader: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu)
 by: Luc - Fri, 4 Nov 2022 18:29 UTC

On Fri, 4 Nov 2022 10:56:05 -0700 (PDT), The Rickster wrote:

> given the string 'Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy
> Bob, Jr}
>
> I am able to use regexp negative look ahead to locate all comma chars in
> positions not enclosed in braces. ,(?![^\{]*\})
>
> However, an regular expression that identify locations of commas external
> to double quotes and braces would be appreciated.
>
> Thanks

Those problems are better handled in multiple stages.

For example, begin by removing everything in quotes or brackets:

regsub -all {"[^"]*"|{[^{}]*}} $string "" variable

Then all remaining commas are what you're looking for. Case closed.

But if you still need to know their exact positions within the original
complete string, then I think you'll have to write your own parser.
But regexp still can help you a lot:

% set FN {Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy Bob, Jr}}
% regexp -all -inline -indices {"} $FN
{10 10} {25 25}

The first double quote is in position 10, the second in position 25.
There are no others.

Let's confirm:

% string first \" $FN 0
10
% string first \" $FN 11
25

OK. Let's continue:

% regexp -all -inline -indices {,} $FN
{20 20} {26 26} {38 38} {55 55}

Four commas: 20, 26, 38, 55.

The first comma is in that 10 to 25 range of the double quotes
so it's out. All others are valid.

The same trick with brackets is too hard because they are a pair, i.e.
not one same character. So I recommend using string first for that:

% string first \{ $FN 0
33

% string first \} $FN 33
37

So all commas within the 33 to 37 range are invalid.

But there are more bracket pairs in the string. You have to find
them all.

You probably can pick up from there.

--
Luc
>>

Re: regexp to locate instances of a specific character when not enclosed in double quotes

<a7f700d4-cf36-4f82-a348-9e0a58cdc6afn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:cc5:b0:6fa:29f2:53df with SMTP id b5-20020a05620a0cc500b006fa29f253dfmr23233848qkj.194.1667621604317;
Fri, 04 Nov 2022 21:13:24 -0700 (PDT)
X-Received: by 2002:a05:620a:2591:b0:6c9:cc85:87e3 with SMTP id
x17-20020a05620a259100b006c9cc8587e3mr28343985qko.577.1667621604130; Fri, 04
Nov 2022 21:13:24 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Fri, 4 Nov 2022 21:13:23 -0700 (PDT)
In-Reply-To: <20221104152948.55d5d04b@lud1.home>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:8001:b500:c130:5008:1538:cdc3:7891;
posting-account=a7bcHgoAAADQ0akqIyRQmxfQdEEZtAt5
NNTP-Posting-Host: 2603:8001:b500:c130:5008:1538:cdc3:7891
References: <945a6512-6687-40d9-b0d7-31fd95c6716fn@googlegroups.com> <20221104152948.55d5d04b@lud1.home>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a7f700d4-cf36-4f82-a348-9e0a58cdc6afn@googlegroups.com>
Subject: Re: regexp to locate instances of a specific character when not
enclosed in double quotes
From: sled99...@gmail.com (The Rickster)
Injection-Date: Sat, 05 Nov 2022 04:13:24 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3411
 by: The Rickster - Sat, 5 Nov 2022 04:13 UTC

On Friday, November 4, 2022 at 11:29:52 AM UTC-7, Luc wrote:
> On Fri, 4 Nov 2022 10:56:05 -0700 (PDT), The Rickster wrote:
>
> > given the string 'Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy
> > Bob, Jr}
> >
> > I am able to use regexp negative look ahead to locate all comma chars in
> > positions not enclosed in braces. ,(?![^\{]*\})
> >
> > However, an regular expression that identify locations of commas external
> > to double quotes and braces would be appreciated.
> >
> > Thanks
> Those problems are better handled in multiple stages.
>
> For example, begin by removing everything in quotes or brackets:
>
> regsub -all {"[^"]*"|{[^{}]*}} $string "" variable
>
> Then all remaining commas are what you're looking for. Case closed.
>
>
> But if you still need to know their exact positions within the original
> complete string, then I think you'll have to write your own parser.
> But regexp still can help you a lot:
>
> % set FN {Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy Bob, Jr}}
> % regexp -all -inline -indices {"} $FN
> {10 10} {25 25}
>
> The first double quote is in position 10, the second in position 25.
> There are no others.
>
> Let's confirm:
>
> % string first \" $FN 0
> 10
> % string first \" $FN 11
> 25
>
> OK. Let's continue:
>
> % regexp -all -inline -indices {,} $FN
> {20 20} {26 26} {38 38} {55 55}
>
> Four commas: 20, 26, 38, 55.
>
> The first comma is in that 10 to 25 range of the double quotes
> so it's out. All others are valid.
>
> The same trick with brackets is too hard because they are a pair, i.e.
> not one same character. So I recommend using string first for that:
>
> % string first \{ $FN 0
> 33
>
> % string first \} $FN 33
> 37
>
> So all commas within the 33 to 37 range are invalid.
>
> But there are more bracket pairs in the string. You have to find
> them all.
>
> You probably can pick up from there.
>
> --
> Luc
> >>
Thanks for confirming that I wasn't missing some trivial solution...;your suggestions are appreciated and will be followed.

Re: regexp to locate instances of a specific character when not enclosed in double quotes

<7c17aa06-f9ac-4e0a-8545-c1ea776afe10n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:1511:b0:6fa:2605:4582 with SMTP id i17-20020a05620a151100b006fa26054582mr25113981qkk.697.1667654754029;
Sat, 05 Nov 2022 06:25:54 -0700 (PDT)
X-Received: by 2002:a05:620a:3720:b0:6dd:beba:b3a1 with SMTP id
de32-20020a05620a372000b006ddbebab3a1mr28435895qkb.138.1667654753873; Sat, 05
Nov 2022 06:25:53 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Sat, 5 Nov 2022 06:25:53 -0700 (PDT)
In-Reply-To: <a7f700d4-cf36-4f82-a348-9e0a58cdc6afn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=84.115.226.18; posting-account=Od2xOAoAAACEyRX3Iu5rYt4oevuoeYUG
NNTP-Posting-Host: 84.115.226.18
References: <945a6512-6687-40d9-b0d7-31fd95c6716fn@googlegroups.com>
<20221104152948.55d5d04b@lud1.home> <a7f700d4-cf36-4f82-a348-9e0a58cdc6afn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7c17aa06-f9ac-4e0a-8545-c1ea776afe10n@googlegroups.com>
Subject: Re: regexp to locate instances of a specific character when not
enclosed in double quotes
From: martin.h...@frequentis.com (heinrichmartin)
Injection-Date: Sat, 05 Nov 2022 13:25:54 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3341
 by: heinrichmartin - Sat, 5 Nov 2022 13:25 UTC

On Saturday, November 5, 2022 at 5:13:26 AM UTC+1, The Rickster wrote:
> On Friday, November 4, 2022 at 11:29:52 AM UTC-7, Luc wrote:
> > On Fri, 4 Nov 2022 10:56:05 -0700 (PDT), The Rickster wrote:
> >
> > > given the string 'Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy
> > > Bob, Jr}
> > >
> > > I am able to use regexp negative look ahead to locate all comma chars in
> > > positions not enclosed in braces. ,(?![^\{]*\})
> > >
> > > However, an regular expression that identify locations of commas external
> > > to double quotes and braces would be appreciated.

A few notes about precise problem statements:
Where does the string end? As there is not closing single quote, is the single quote part of the string?
We currently experience two threads on c.l.t. that demonstrate the XY-problem - everyone can learn from that, too.

Are you looking for the comma or are you looking for the definitions "* be *"?
What is the grammar? May quotation marks or braces be nested or escaped?
Does repeated whitespace matter? Which whitespace? May the statement span lines?

% set in {Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy Bob, Jr}}
Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy Bob, Jr}
% set kv [regexp -all -inline {(^Let\s|,)\s*(\w+)\s+be\s+([^,]+|"[^"]+"|\{[^\}]+\})\s*(?=,|$)} $in]
{Let FN be "Billy Bob, jr."} {Let } FN {"Billy Bob, jr."} {,MI be {Bob}} , MI {{Bob}} {,LN be {Billy Bob, Jr}} , LN {{Billy Bob, Jr}}
% dict get $kv FN
"Billy Bob, jr."
% dict get $kv MI
{Bob}
% dict get $kv LN
{Billy Bob, Jr}

> > Those problems are better handled in multiple stages.

I disagree with the general statement (e.g. most parsers work be traversing the input only once), but I agree that regexp need not be the best solution.

> Thanks for confirming that I wasn't missing some trivial solution...;your suggestions are appreciated and will be followed.

A single negative answer does not mean that no trivial solution exists - especially in the setting of an XY-problem.

Re: regexp to locate instances of a specific character when not enclosed in double quotes

<73efcbbf-56e1-42b1-8638-c7ed303e4438n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:622a:4d06:b0:35d:42d0:25f with SMTP id fd6-20020a05622a4d0600b0035d42d0025fmr155427qtb.18.1668145835214;
Thu, 10 Nov 2022 21:50:35 -0800 (PST)
X-Received: by 2002:ac8:750f:0:b0:3a5:4d30:851a with SMTP id
u15-20020ac8750f000000b003a54d30851amr124317qtq.356.1668145835024; Thu, 10
Nov 2022 21:50:35 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Thu, 10 Nov 2022 21:50:34 -0800 (PST)
In-Reply-To: <7c17aa06-f9ac-4e0a-8545-c1ea776afe10n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:8001:b500:c130:7db3:8b0e:d5a3:caf5;
posting-account=a7bcHgoAAADQ0akqIyRQmxfQdEEZtAt5
NNTP-Posting-Host: 2603:8001:b500:c130:7db3:8b0e:d5a3:caf5
References: <945a6512-6687-40d9-b0d7-31fd95c6716fn@googlegroups.com>
<20221104152948.55d5d04b@lud1.home> <a7f700d4-cf36-4f82-a348-9e0a58cdc6afn@googlegroups.com>
<7c17aa06-f9ac-4e0a-8545-c1ea776afe10n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <73efcbbf-56e1-42b1-8638-c7ed303e4438n@googlegroups.com>
Subject: Re: regexp to locate instances of a specific character when not
enclosed in double quotes
From: sled99...@gmail.com (The Rickster)
Injection-Date: Fri, 11 Nov 2022 05:50:35 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 39
 by: The Rickster - Fri, 11 Nov 2022 05:50 UTC

On Saturday, November 5, 2022 at 6:25:56 AM UTC-7, heinrichmartin wrote:
> On Saturday, November 5, 2022 at 5:13:26 AM UTC+1, The Rickster wrote:
> > On Friday, November 4, 2022 at 11:29:52 AM UTC-7, Luc wrote:
> > > On Fri, 4 Nov 2022 10:56:05 -0700 (PDT), The Rickster wrote:
> > >
> > > > given the string 'Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy
> > > > Bob, Jr}
> > > >
> > > > I am able to use regexp negative look ahead to locate all comma chars in
> > > > positions not enclosed in braces. ,(?![^\{]*\})
> > > >
> > > > However, an regular expression that identify locations of commas external
> > > > to double quotes and braces would be appreciated.
> A few notes about precise problem statements:
> Where does the string end? As there is not closing single quote, is the single quote part of the string?
> We currently experience two threads on c.l.t. that demonstrate the XY-problem - everyone can learn from that, too.
>
> Are you looking for the comma or are you looking for the definitions "* be *"?
> What is the grammar? May quotation marks or braces be nested or escaped?
> Does repeated whitespace matter? Which whitespace? May the statement span lines?
>
> % set in {Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy Bob, Jr}}
> Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy Bob, Jr}
> % set kv [regexp -all -inline {(^Let\s|,)\s*(\w+)\s+be\s+([^,]+|"[^"]+"|\{[^\}]+\})\s*(?=,|$)} $in]
> {Let FN be "Billy Bob, jr."} {Let } FN {"Billy Bob, jr."} {,MI be {Bob}} , MI {{Bob}} {,LN be {Billy Bob, Jr}} , LN {{Billy Bob, Jr}}
> % dict get $kv FN
> "Billy Bob, jr."
> % dict get $kv MI
> {Bob}
> % dict get $kv LN
> {Billy Bob, Jr}
> > > Those problems are better handled in multiple stages.
> I disagree with the general statement (e.g. most parsers work be traversing the input only once), but I agree that regexp need not be the best solution.
> > Thanks for confirming that I wasn't missing some trivial solution...;your suggestions are appreciated and will be followed.
> A single negative answer does not mean that no trivial solution exists - especially in the setting of an XY-problem.
Answers:
There is no closing quote. A string of text may be enclosed in double quotes or braces.
One can ignore the "Let" portion of the string. The intent is to be able to evaluate each ?varname be ?textstring, where text string is delimited by braces or double quotes.
The statement does not span lines and repeated white space does not matter.
Initial thoughts were to replace each comma with a 'non printable' character (e.g. x03) and then split the string..

Re: regexp to locate instances of a specific character when not enclosed in double quotes

<ad37b57d-68de-416a-919e-635b5e6e6e38n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:6214:2e84:b0:4bb:717e:1462 with SMTP id oc4-20020a0562142e8400b004bb717e1462mr787211qvb.49.1668146310328;
Thu, 10 Nov 2022 21:58:30 -0800 (PST)
X-Received: by 2002:ac8:7c6:0:b0:3a5:460f:79c8 with SMTP id
m6-20020ac807c6000000b003a5460f79c8mr119673qth.501.1668146310144; Thu, 10 Nov
2022 21:58:30 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Thu, 10 Nov 2022 21:58:29 -0800 (PST)
In-Reply-To: <73efcbbf-56e1-42b1-8638-c7ed303e4438n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:8001:b500:c130:7db3:8b0e:d5a3:caf5;
posting-account=a7bcHgoAAADQ0akqIyRQmxfQdEEZtAt5
NNTP-Posting-Host: 2603:8001:b500:c130:7db3:8b0e:d5a3:caf5
References: <945a6512-6687-40d9-b0d7-31fd95c6716fn@googlegroups.com>
<20221104152948.55d5d04b@lud1.home> <a7f700d4-cf36-4f82-a348-9e0a58cdc6afn@googlegroups.com>
<7c17aa06-f9ac-4e0a-8545-c1ea776afe10n@googlegroups.com> <73efcbbf-56e1-42b1-8638-c7ed303e4438n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ad37b57d-68de-416a-919e-635b5e6e6e38n@googlegroups.com>
Subject: Re: regexp to locate instances of a specific character when not
enclosed in double quotes
From: sled99...@gmail.com (The Rickster)
Injection-Date: Fri, 11 Nov 2022 05:58:30 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4492
 by: The Rickster - Fri, 11 Nov 2022 05:58 UTC

On Thursday, November 10, 2022 at 9:50:37 PM UTC-8, The Rickster wrote:
> On Saturday, November 5, 2022 at 6:25:56 AM UTC-7, heinrichmartin wrote:
> > On Saturday, November 5, 2022 at 5:13:26 AM UTC+1, The Rickster wrote:
> > > On Friday, November 4, 2022 at 11:29:52 AM UTC-7, Luc wrote:
> > > > On Fri, 4 Nov 2022 10:56:05 -0700 (PDT), The Rickster wrote:
> > > >
> > > > > given the string 'Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy
> > > > > Bob, Jr}
> > > > >
> > > > > I am able to use regexp negative look ahead to locate all comma chars in
> > > > > positions not enclosed in braces. ,(?![^\{]*\})
> > > > >
> > > > > However, an regular expression that identify locations of commas external
> > > > > to double quotes and braces would be appreciated.
> > A few notes about precise problem statements:
> > Where does the string end? As there is not closing single quote, is the single quote part of the string?
> > We currently experience two threads on c.l.t. that demonstrate the XY-problem - everyone can learn from that, too.
> >
> > Are you looking for the comma or are you looking for the definitions "* be *"?
> > What is the grammar? May quotation marks or braces be nested or escaped?
> > Does repeated whitespace matter? Which whitespace? May the statement span lines?
> >
> > % set in {Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy Bob, Jr}}
> > Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy Bob, Jr}
> > % set kv [regexp -all -inline {(^Let\s|,)\s*(\w+)\s+be\s+([^,]+|"[^"]+"|\{[^\}]+\})\s*(?=,|$)} $in]
> > {Let FN be "Billy Bob, jr."} {Let } FN {"Billy Bob, jr."} {,MI be {Bob}} , MI {{Bob}} {,LN be {Billy Bob, Jr}} , LN {{Billy Bob, Jr}}
> > % dict get $kv FN
> > "Billy Bob, jr."
> > % dict get $kv MI
> > {Bob}
> > % dict get $kv LN
> > {Billy Bob, Jr}
> > > > Those problems are better handled in multiple stages.
> > I disagree with the general statement (e.g. most parsers work be traversing the input only once), but I agree that regexp need not be the best solution.
> > > Thanks for confirming that I wasn't missing some trivial solution...;your suggestions are appreciated and will be followed.
> > A single negative answer does not mean that no trivial solution exists - especially in the setting of an XY-problem.
> Answers:
> There is no closing quote. A string of text may be enclosed in double quotes or braces.
> One can ignore the "Let" portion of the string. The intent is to be able to evaluate each ?varname be ?textstring, where text string is delimited by braces or double quotes.
> The statement does not span lines and repeated white space does not matter.
> Initial thoughts were to replace each comma with a 'non printable' character (e.g. x03) and then split the string..
Hey, lesson learned - A single negative answer does not mean that no trivial solution exists - especially in the setting of an XY-problem.
The regexp you supplies is what was needed. What is c.l.t. ? how can I access?
Rick

Re: regexp to locate instances of a specific character when not enclosed in double quotes

<tkkskt$pokq$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: wortka...@yahoo.com (Harald Oehlmann)
Newsgroups: comp.lang.tcl
Subject: Re: regexp to locate instances of a specific character when not
enclosed in double quotes
Date: Fri, 11 Nov 2022 08:12:30 +0100
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <tkkskt$pokq$1@dont-email.me>
References: <945a6512-6687-40d9-b0d7-31fd95c6716fn@googlegroups.com>
<20221104152948.55d5d04b@lud1.home>
<a7f700d4-cf36-4f82-a348-9e0a58cdc6afn@googlegroups.com>
<7c17aa06-f9ac-4e0a-8545-c1ea776afe10n@googlegroups.com>
<73efcbbf-56e1-42b1-8638-c7ed303e4438n@googlegroups.com>
<ad37b57d-68de-416a-919e-635b5e6e6e38n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 11 Nov 2022 07:12:29 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="d9f2dfbb466e4e50b5ff6e463bd0dcda";
logging-data="844442"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/r27ZJ/Zu+wqbFme4BYooH"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Cancel-Lock: sha1:Y6dTj7+37paWn+EhuBnLhjYZVyY=
In-Reply-To: <ad37b57d-68de-416a-919e-635b5e6e6e38n@googlegroups.com>
Content-Language: en-GB
 by: Harald Oehlmann - Fri, 11 Nov 2022 07:12 UTC

Am 11.11.2022 um 06:58 schrieb The Rickster:
> The regexp you supplies is what was needed. What is c.l.t. ? how can I access?
> Rick

Rick,
happy, that it worked for you.
clt (or c.l.t) is the abreviation of the comp.lang.tcl news group.
That is, what this message ues

Abou the acess: many people are quite unhappy with the access provided
by google and a "real" news reader may be helpful.

You may consult the wiki page for information:
wiki.tcl-lang.org/clt

Enjoy,
Harald

Re: regexp to locate instances of a specific character when not enclosed in double quotes

<63e44b0e-e1a8-437f-97c5-1b2df1c5b9c1n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:ad4:51c2:0:b0:4bb:781e:6232 with SMTP id p2-20020ad451c2000000b004bb781e6232mr918217qvq.15.1668150841363;
Thu, 10 Nov 2022 23:14:01 -0800 (PST)
X-Received: by 2002:ac8:100d:0:b0:3a5:2751:ce81 with SMTP id
z13-20020ac8100d000000b003a52751ce81mr280249qti.322.1668150841174; Thu, 10
Nov 2022 23:14:01 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Thu, 10 Nov 2022 23:14:00 -0800 (PST)
In-Reply-To: <ad37b57d-68de-416a-919e-635b5e6e6e38n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=84.115.226.59; posting-account=Od2xOAoAAACEyRX3Iu5rYt4oevuoeYUG
NNTP-Posting-Host: 84.115.226.59
References: <945a6512-6687-40d9-b0d7-31fd95c6716fn@googlegroups.com>
<20221104152948.55d5d04b@lud1.home> <a7f700d4-cf36-4f82-a348-9e0a58cdc6afn@googlegroups.com>
<7c17aa06-f9ac-4e0a-8545-c1ea776afe10n@googlegroups.com> <73efcbbf-56e1-42b1-8638-c7ed303e4438n@googlegroups.com>
<ad37b57d-68de-416a-919e-635b5e6e6e38n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <63e44b0e-e1a8-437f-97c5-1b2df1c5b9c1n@googlegroups.com>
Subject: Re: regexp to locate instances of a specific character when not
enclosed in double quotes
From: martin.h...@frequentis.com (heinrichmartin)
Injection-Date: Fri, 11 Nov 2022 07:14:01 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4948
 by: heinrichmartin - Fri, 11 Nov 2022 07:14 UTC

On Friday, November 11, 2022 at 6:58:32 AM UTC+1, Rick wrote:
> On Thursday, November 10, 2022 at 9:50:37 PM UTC-8, The Rickster wrote:
> > On Saturday, November 5, 2022 at 6:25:56 AM UTC-7, heinrichmartin wrote:
> > > On Saturday, November 5, 2022 at 5:13:26 AM UTC+1, The Rickster wrote:
> > > > On Friday, November 4, 2022 at 11:29:52 AM UTC-7, Luc wrote:
> > > > > On Fri, 4 Nov 2022 10:56:05 -0700 (PDT), The Rickster wrote:
> > > > >
> > > > > > given the string 'Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy
> > > > > > Bob, Jr}
> > > > > >
> > > > > > I am able to use regexp negative look ahead to locate all comma chars in
> > > > > > positions not enclosed in braces. ,(?![^\{]*\})
> > > > > >
> > > > > > However, an regular expression that identify locations of commas external
> > > > > > to double quotes and braces would be appreciated.
> > > A few notes about precise problem statements:
> > > Where does the string end? As there is not closing single quote, is the single quote part of the string?
> > > We currently experience two threads on c.l.t. that demonstrate the XY-problem - everyone can learn from that, too.
> > >
> > > Are you looking for the comma or are you looking for the definitions "* be *"?
> > > What is the grammar? May quotation marks or braces be nested or escaped?
> > > Does repeated whitespace matter? Which whitespace? May the statement span lines?
> > >
> > > % set in {Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy Bob, Jr}}
> > > Let FN be "Billy Bob, jr.",MI be {Bob},LN be {Billy Bob, Jr}
> > > % set kv [regexp -all -inline {(^Let\s|,)\s*(\w+)\s+be\s+([^,]+|"[^"]+"|\{[^\}]+\})\s*(?=,|$)} $in]
> > > {Let FN be "Billy Bob, jr."} {Let } FN {"Billy Bob, jr."} {,MI be {Bob}} , MI {{Bob}} {,LN be {Billy Bob, Jr}} , LN {{Billy Bob, Jr}}
> > > % dict get $kv FN
> > > "Billy Bob, jr."
> > > % dict get $kv MI
> > > {Bob}
> > > % dict get $kv LN
> > > {Billy Bob, Jr}
> > > > > Those problems are better handled in multiple stages.
> > > I disagree with the general statement (e.g. most parsers work be traversing the input only once), but I agree that regexp need not be the best solution.
> > > > Thanks for confirming that I wasn't missing some trivial solution...;your suggestions are appreciated and will be followed.
> > > A single negative answer does not mean that no trivial solution exists - especially in the setting of an XY-problem.
> > Answers:
> > There is no closing quote. A string of text may be enclosed in double quotes or braces.
> > One can ignore the "Let" portion of the string. The intent is to be able to evaluate each ?varname be ?textstring, where text string is delimited by braces or double quotes.
> > The statement does not span lines and repeated white space does not matter.
> > Initial thoughts were to replace each comma with a 'non printable' character (e.g. x03) and then split the string..
> Hey, lesson learned - A single negative answer does not mean that no trivial solution exists - especially in the setting of an XY-problem.
> The regexp you supplies is what was needed.

lesson*s* ;-) You gave up too soon, and you had asked for Y while trying to solve X[1].

> What is c.l.t. ? how can I access?

It is an abbreviation for the usenet[2] group comp.lang.tcl. We are currently exchanging messages there.

[1] https://en.wikipedia.org/wiki/XY_problem
[2] https://en.wikipedia.org/wiki/Usenet

Re: regexp to locate instances of a specific character when not enclosed in double quotes

<20221111084429.10cac844@lud1.home>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!ac6OoMHkWYPV8qf+a92lSg.user.46.165.242.75.POSTED!not-for-mail
From: no...@no.no (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: regexp to locate instances of a specific character when not
enclosed in double quotes
Date: Fri, 11 Nov 2022 08:44:29 -0300
Organization: Aioe.org NNTP Server
Message-ID: <20221111084429.10cac844@lud1.home>
References: <945a6512-6687-40d9-b0d7-31fd95c6716fn@googlegroups.com>
<20221104152948.55d5d04b@lud1.home>
<a7f700d4-cf36-4f82-a348-9e0a58cdc6afn@googlegroups.com>
<7c17aa06-f9ac-4e0a-8545-c1ea776afe10n@googlegroups.com>
<73efcbbf-56e1-42b1-8638-c7ed303e4438n@googlegroups.com>
<ad37b57d-68de-416a-919e-635b5e6e6e38n@googlegroups.com>
<63e44b0e-e1a8-437f-97c5-1b2df1c5b9c1n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="7936"; posting-host="ac6OoMHkWYPV8qf+a92lSg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Newsreader: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu)
X-Notice: Filtered by postfilter v. 0.9.2
 by: Luc - Fri, 11 Nov 2022 11:44 UTC

On Thu, 10 Nov 2022 21:58:29 -0800 (PST), The Rickster wrote:

> What is c.l.t. ? how can I access? Rick

You're in it. :-)

Whatever you're doing, you're doing it right.

On Thu, 10 Nov 2022 23:14:00 -0800 (PST), heinrichmartin wrote:

> > What is c.l.t. ? how can I access?
>
> It is an abbreviation for the usenet[2] group comp.lang.tcl. We are
> currently exchanging messages there.

Your use of "there" may confuse him. It's not "there." It's here.

--
Luc
>>

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor