To clarify, this isn't a question about what a caret (^) or a dollar sign ($) does in a regular expression.
In modern keyboards with QWERTY layout, ^
comes after $
(i.e., ^
appears above the number 6 and $
above 4), so I always have a moment of hand-eye discoordination when I use them like ^foobar$
.
So I was curious why, historically, the caret and dollar sign were chosen to match the beginning/end of a line because it would be more intuitive if they were reversed.
Perhaps they had a different keyboard layout back then? Apparently, the reason ESC was chosen to change mode in vi was that it made sense for Bill Joy's keyboard: why vim uses hjkl keys as arrow keys.
^
is already located on the home key, as is~
... – frostschutz Jul 12 '20 at 11:58$
could be an ASCII replacement for Σ which often used as terminal character for describing formal languages.+
and*
are Kleen operators for sure. – andreoss Jul 13 '20 at 01:23