[TUHS] RegExp decision for meta characters: Circumflex

markus schnalke meillo at marmaro.de
Fri Sep 17 18:52:00 AEST 2021


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


More information about the TUHS mailing list