The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Rob Pike <robpike@gmail.com>
To: markus schnalke <meillo@marmaro.de>
Cc: TUHS main list <tuhs@minnie.tuhs.org>
Subject: Re: [TUHS] RegExp decision for meta characters: Circumflex
Date: Fri, 17 Sep 2021 19:32:28 +1000	[thread overview]
Message-ID: <CAKzdPgzRreiFGdChnfQsZnv0E+sc_TJGVxJme8V9CgVtcQF7aQ@mail.gmail.com> (raw)
In-Reply-To: <CAKzdPgyos3psLGBiVde3M0OkpR2FW7483+5NFnM0XX316Cp_4g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1631 bytes --]

*NOT* the same. Sorry....

I hope the example explains better than my prose.

-rob


On Fri, Sep 17, 2021 at 7:32 PM Rob Pike <robpike@gmail.com> wrote:

> You'd have to ask ken why he chose the characters he did, but I can answer
> the second question. The beginning and end of line are the same. If you
> make ^ mean both beginning and end of line, what does this ed command do:
>
> s/^/x/
>
> Which end gets the x?
>
> -rob
>
>
> On Fri, Sep 17, 2021 at 7:00 PM markus schnalke <meillo@marmaro.de> wrote:
>
>> Hoi,
>>
>> I'm interested in the early design decisions for meta characters
>> in REs, mainly regarding Ken's RE implementation in ed.
>>
>> Two questions:
>>
>> 1) Circumflex
>>
>> As far as I see, the circumflex (^) is the only meta character that
>> has two different special meanings in REs: First being the
>> beginning of line anchor and second inverting a character class.
>> Why was it chosen for the second one? Why not the exclamation mark
>> in that case? (Sure, C didn't exist by then, but the bang probably
>> was used to negate in other languages of the time, I think.)
>>
>> 2) Symbol for the end of line anchor
>>
>> What is the reason that the beginning of line and end of line
>> anchors are different symbols? Is there a reason why not only one
>> symbol, say the circumflex, was chosen to represent both? I
>> currently see no disadvantages of such a design. (Circumflexes
>> aren't likely to end lines of text, neither.)
>>
>> I would appreciate if you could help me understand these design
>> decisions better. Maybe there existed RE notations that were simply
>> copied ...
>>
>>
>> meillo
>>
>

[-- Attachment #2: Type: text/html, Size: 2413 bytes --]

  reply	other threads:[~2021-09-17  9:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17  8:52 markus schnalke
2021-09-17  9:32 ` Rob Pike
2021-09-17  9:32   ` Rob Pike [this message]
2021-09-17 10:10   ` markus schnalke
2021-09-17 16:40 Douglas McIlroy
2021-09-17 20:40 ` Chris Torek
2021-09-18  1:03   ` Greg 'groggy' Lehey
2021-09-18  1:23     ` Bakul Shah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKzdPgzRreiFGdChnfQsZnv0E+sc_TJGVxJme8V9CgVtcQF7aQ@mail.gmail.com \
    --to=robpike@gmail.com \
    --cc=meillo@marmaro.de \
    --cc=tuhs@minnie.tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).