Why do regexes use `$` and `^` as line anchors? (2024)
buttondown.com
Why do regexes use `$` and `^` as line anchors? (2024)
1–10 of 48 posts
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#2Re: Why do regexes use `$` and `^` as line anchors? (2024)
#3Re: Why do regexes use `$` and `^` as line anchors? (2024)
#4I actually had a typewriter without one. I would simulate it with S / which was not very satisfactory but generally understandable in context.
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#5This is one of the great things about this age. The barrier of reaching out to some person and asking them a question has never been lower. I've done this for RFCs, I've done this for questions about blog posts I've discovered here on HN. I've gotten lots of responses from people and it's always been illuminating to me.
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#6Could it be a similar reason?
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#7> $ 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.
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#8My AZERTY keyboard conveniently has them side by side (^ left of $). Could it be a similar reason?
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#9My AZERTY keyboard conveniently has them side by side (^ left of $). Could it be a similar reason?
The standard QWERTY layout for the number key row is `/~, 1/!, 2/@, 3/#, 4/$, 5/%, 6/^, 7/&, 8/*, 9/(, 0/), -/_, =/+. I don't know how far back the mapping of shift keys for the numbers go, but I'd be shocked if there was any around the 1960s or 1970s that put them like your AZERTY keyboard.
Re: Why do regexes use `$` and `^` as line anchors? (2024)
#10My AZERTY keyboard conveniently has them side by side (^ left of $). Could it be a similar reason?