Article View: comp.lang.tcl
Article #50Re: A behaviour of regexp I cannot understand
From: Rich
Date: Wed, 14 Oct 2026 19:46
Date: Wed, 14 Oct 2026 19:46
31 lines
2425 bytes
2425 bytes
Olivier <user1108@newsgrouper.org.invalid> wrote:
>
> Erik Leunissen <elns@xs4all.nl> posted:
>
>> On 10/14/26 17:05, Olivier wrote:
>> > regexp -inline -all {\S+} "dum dummy a b c d c4"
>>
>> Did you mean to do:
>>
>> regexp -inline -all {\s+} "dum dummy a b c d c4"
>>
>> Note the lower case character "s".
>>
>> Erik Leunissen
>
> Ah ! Thank you, your message makes me look (again) at the definition
> of \S with an uppercase : \S <==> [^[:space:]] . I did not pay
> attention to the "^" wich means : "If the list begins with “^”, it
> matches any single character (but see below) not from the rest of the
> list."
>
> The behaviour is now obvious ! It was in the documentation, but I
> had in mind that "^" was relative to the "beginning of", not that
> usage.
Sadly, ^ does double duty in regular expressions. It is an anchor,
when used outside bracket expressions ([]) and it is the negation
operator when used inside bracket expressions, but then, only if it is
the first character in the bracket expression, otherwise it is just
itself if it occurs elsewhere in brackets.
Technical Details
Message-ID:
<11aom6h$1pc17$2@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<1791990352-1108@newsgrouper.org> <9ba7d49d-d931-8d3e-159c-a76c9fe26100@xs4all.nl> <1792004591-1108@newsgrouper.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Rich <rich@example.invalid>
Newsgroups: comp.lang.tcl
Subject: Re: A behaviour of regexp I cannot understand
Date: Wed, 14 Oct 2026 19:46:25 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <11aom6h$1pc17$2@dont-email.me>
References: <1791990352-1108@newsgrouper.org> <9ba7d49d-d931-8d3e-159c-a76c9fe26100@xs4all.nl> <1792004591-1108@newsgrouper.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 14 Oct 2026 19:46:26 +0000 (UTC)
Injection-Info: dont-email.me;
logging-data="1880103"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LTggqlfsHbRr4nbsEDu4Z"; posting-host="aa35b32e43f7ff453a6f4eed126df023"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.193 (x86_64))
Cancel-Lock: sha1:vE6ffIumHwuLVrjcE9zEI7GWlS0= sha256:DkkAqKOvCGKhcADoUOLGxVagNPCom3EYfrrP5JojhV8=
sha1:imRJl+/acH1Tt7LhPQlgr+sIH/E= sha256:3OPQWfrehG5ZwKiazkXEJ6oyYojRQYzzw2W1ba6u9/E=