Maybe there is some hidden and forgotten by everyone reason why those keys were choosen? In the same vein as this link http://www.catonmat.net/blog/why-vim-uses-hjkl-as-arrow-keys/ explains use of hjkl in vim and ~ in bash, maybe there is some story behind ^ and $? Actually, on the picture in that article, the terminal shown doesn't even have a ^ key.
I'd really appreciate if somebody will tell or show the keyboard layout used by Ken Thompson when he written a version of QED that supported regex. (And if people stop trying to be funny in the comments).
edit:
These are some amasing replies. Even if they are just guesses, they may serve like a great mnemonic material. Thank you! Just wish you didn't put it on hold so fast, maybe some people were too slow to answer.
It's hardly possible to answer this question today because regexps were introduced more than fifty years ago. I may share versions that seem the most reasonable for me.
Dollar sign was symbolizing the end of line yet in ed editor. First practical implementation of RE were introduced namely in ed and derivatives (like QED). And dollar sign was reused. It meant either the end of line or the last line, depending on context. This is more or less clear but the question why dollar sign was initially denoted the end of something yet remains. It ('$') seems to be an "ASCII approximation" of a typographic "end of paragraph" sign.
As for '^' as the beginning of line, it's probably an "ASCII approximation" of Lambda Greek letter which stood for an empty expression in early theoretical works like this: http://www.fing.edu.uy/inco/cursos/intropln/material/p419-thompson.pdf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With