Search code examples
regexline-endingsmnemonicsend-of-linestart-of-line

Why is the start of a line "^" and the end of line "$"?


I never remember whether ^ matches the beginning of the line and $ matches the end of it or the other way around. A good mnemonic would be that the $ sign is always before the price, therefore it matches the beginning of a line - unfortunately it's the other way around.

So is there any reason why these two characters were chosen for the beginning and end of line?


Solution

  • One mnemonic: In an auction, bidders start by raising ^ their paddles. The price $ is established at the end.