This article is about a bit of surprising behavior I recently discovered using Python's regex module (re) while developing SBOM tooling for CPython. Folks who've worked with regular expressions before might know about ^ meaning "start-of-string" and correspondingly see $ as "end-of-string". So the pattern cat$ would match the string "lolcat" but not "internet cat video". The behavior of ^ made me
![Regex character “$” doesn't mean “end-of-string”](https://cdn-ak-scissors.b.st-hatena.com/image/square/98d528fd54445ae2c6f4714c18691c35559ddfb2/height=288;version=1;width=512/https%3A%2F%2Fgithub.com%2Fsethmlarson.png)