The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: markus schnalke <meillo@marmaro.de>
To: tuhs@minnie.tuhs.org
Subject: [TUHS] RegExp decision for meta characters: Circumflex
Date: Fri, 17 Sep 2021 10:52:00 +0200	[thread overview]
Message-ID: <1mR9bE-8RG-00@marmaro.de> (raw)

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

             reply	other threads:[~2021-09-17  8:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17  8:52 markus schnalke [this message]
2021-09-17  9:32 ` Rob Pike
2021-09-17  9:32   ` Rob Pike
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=1mR9bE-8RG-00@marmaro.de \
    --to=meillo@marmaro.de \
    --cc=tuhs@minnie.tuhs.org \
    --subject='Re: [TUHS] RegExp decision for meta characters: Circumflex' \
    /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

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).