<story><title>Regex character &quot;$&quot; doesn&apos;t mean &quot;end-of-string&quot;</title><url>https://sethmlarson.dev/regex-$-matches-end-of-string-or-newline</url></story><parent_chain><item><author>Karellen</author><text>&amp;gt; Folks who&amp;#x27;ve worked with regular expressions before might know about ^ meaning &amp;quot;start-of-string&amp;quot; and correspondingly see $ as &amp;quot;end-of-string&amp;quot;.&lt;p&gt;Huh. I always think of them as &amp;quot;start-of-line&amp;quot; and &amp;quot;end-of-line&amp;quot;. I mean, a lot of the time when I&amp;#x27;m working with regexes, I&amp;#x27;m working with text a line at a time so the effect is the same, but that doesn&amp;#x27;t change how I think of those operators.&lt;p&gt;Maybe because a fair amount of the work I do with regexes (and, probably, how I was introduced to them) is via `grep`, so I&amp;#x27;m often thinking of the inputs as &amp;quot;lines&amp;quot; rather than &amp;quot;strings&amp;quot;?</text></item></parent_chain><comment><author>Izkata</author><text>Same here; when I saw the title I was like &amp;quot;well obviously not, where did you hear that?&amp;quot;&lt;p&gt;In nearly two decades of using regex I think this might be the first time I&amp;#x27;ve heard of $ being end of string. It&amp;#x27;s always been end of line for me.</text></comment>
<story><title>Regex character &quot;$&quot; doesn&apos;t mean &quot;end-of-string&quot;</title><url>https://sethmlarson.dev/regex-$-matches-end-of-string-or-newline</url></story><parent_chain><item><author>Karellen</author><text>&amp;gt; Folks who&amp;#x27;ve worked with regular expressions before might know about ^ meaning &amp;quot;start-of-string&amp;quot; and correspondingly see $ as &amp;quot;end-of-string&amp;quot;.&lt;p&gt;Huh. I always think of them as &amp;quot;start-of-line&amp;quot; and &amp;quot;end-of-line&amp;quot;. I mean, a lot of the time when I&amp;#x27;m working with regexes, I&amp;#x27;m working with text a line at a time so the effect is the same, but that doesn&amp;#x27;t change how I think of those operators.&lt;p&gt;Maybe because a fair amount of the work I do with regexes (and, probably, how I was introduced to them) is via `grep`, so I&amp;#x27;m often thinking of the inputs as &amp;quot;lines&amp;quot; rather than &amp;quot;strings&amp;quot;?</text></item></parent_chain><comment><author>wccrawford</author><text>It&amp;#x27;s kind of driving me nuts that the article says ^ is &amp;quot;start of string&amp;quot; when it&amp;#x27;s actually &amp;quot;start of line&amp;quot;, just like $ is &amp;quot;end of line&amp;quot;.  \A is apparently &amp;quot;start of string&amp;quot; like \Z is &amp;quot;end of string&amp;quot;.</text></comment>