> $ is so important in business that every typewriter has one I actually had a typewriter without one. I would simulate it with S / which was not very satisfactory but generally understandable in context.
Was it a US typewriter? This peso symbol is very important in business in the US and Latin America but not, for example, England, Ireland, India, Finland, or Sweden.
Why do regexes use `$` and `^` as line anchors? (2024)
31–40 of 48 posts
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#32Earlier quoted context omitted.
It does come in handy if you search for stuff with regular expressions a lot!
I do search with regex pretty often and as a result have memorized these, but if I was mentoring someone I would never encourage them to memorize it. Start with . and .*, then add additional stuff as you get comfortable
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#33I remember when learning regexes, struggling to remember which of ^ and $ were the beginning or end of the line. I know that my (and many other) shells used $ as the prompt symbol - i.e. at the beginning of what I was to type in the terminal. It being at the beginning of that line made it easy for me to remember that it also marks the beginning of regexes. Of course I was 100% incorrect as $ is in fact the end-of-lin…
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#34At least for ^ I was always told that the ADM3a terminal keyboard had a HOME key with ~ and ^ on it, which is why ~ means "home directory", and ^ means "home of the line".
https://www.hillelwayne.com/post/always-more-history/
Whether that explains the use of tilde and caret, I dont know.
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#35> $ is so important in business that every typewriter has one I actually had a typewriter without one. I would simulate it with S / which was not very satisfactory but generally understandable in context.
Was it a US typewriter? This peso symbol is very important in business in the US and Latin America but not, for example, England, Ireland, India, Finland, or Sweden.
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#36I remember when learning regexes, struggling to remember which of ^ and $ were the beginning or end of the line. I know that my (and many other) shells used $ as the prompt symbol - i.e. at the beginning of what I was to type in the terminal. It being at the beginning of that line made it easy for me to remember that it also marks the beginning of regexes. Of course I was 100% incorrect as $ is in fact the end-of-lin…
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#37There is also Pascal's ^pointer syntax for the other end of things.
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#38Earlier quoted context omitted.
Was it a US typewriter? This peso symbol is very important in business in the US and Latin America but not, for example, England, Ireland, India, Finland, or Sweden.
I know this symbol is used for pesos, but when 24 countries refer to it as "dollar"[0] compared to 7 for "peso" it seems fair to call it a dollar symbol? Not to mention that it's referred to as "dollar" in unicode. It's also very interesting to me that [1] mentions it can have one or two bars but in the list above the double-barred version is not only not in unicode but refers specifically to the cifrão[2]. I guess t…
https://en.wikipedia.org/wiki/Peso
> In most countries of the Americas, the symbol commonly known as dollar sign, "$", was originally used as an abbreviation of "pesos" and later adopted by the dollar. The dollar itself actually originated from the peso or Spanish dollar in the late 18th century.
https://en.wikipedia.org/wiki/Dollar_sign#History
> The symbol appears in business correspondence in the 1770s from Spanish America, the early independent U.S., British America and Britain, referring to the Spanish American peso,[1][2] also known as "Spanish dollar" or "piece of eight" in British America. Those coins provided the model for the currency that the United States adopted in 1792, and for the larger coins of the new Spanish American republics, such as the Mexican peso, Argentine peso, Peruvian real, and Bolivian sol coins.
https://en.wikipedia.org/wiki/Spanish_dollar
> Most theories trace the origin of the "$" symbol, which originally had two vertical bars, to the pillars of Hercules wrapped in ribbons that appear on the reverse side of the Spanish dollar.[6] ¶ The term peso was used in Spanish to refer to this denomination, (...)
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#39Earlier quoted context omitted.
Was it a US typewriter? This peso symbol is very important in business in the US and Latin America but not, for example, England, Ireland, India, Finland, or Sweden.
It would depend on the age of the typewriter, even the US. Many early ones did not have dedicated keys for symbols, which were made as the parent describes: by going back and typing another character over them (e.g., S backspace / to get a dollar sign).
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#40Earlier quoted context omitted.
I know this symbol is used for pesos, but when 24 countries refer to it as "dollar"[0] compared to 7 for "peso" it seems fair to call it a dollar symbol? Not to mention that it's referred to as "dollar" in unicode. It's also very interesting to me that [1] mentions it can have one or two bars but in the list above the double-barred version is not only not in unicode but refers specifically to the cifrão[2]. I guess t…
It's a peso sign. The English word for the Spanish "peso" at the time was "dollar", and the US dollar was initially defined to be equal to the Spanish "dollar". The US dollar, which was a coin, had the same value as the Spanish peso because it consisted of the same weight (in Spanish, "peso") of silver. So the US used the peso sign for its dollars. Unicode calls it a "dollar sign" because that's what ASCII calls it,…
I wonder if it is a coincidence that "peso" sounds pretty similar to "piece of"