&gt; The regex here is using an r&quot;&quot; string, as all regexes should.<p>I don&#x27;t understand how \ ever became the escape character for regular expressions (and JSON!) in the first place. Every language gets its own unique escape character -- that way, you don&#x27;t need an exponential number of characters in the source code to represent a single character in the model. This seems to have been understood early on; C uses \ as the escape character for strings and % as the escape character for printf directives. Common Lisp uses \ for strings and ~ for format directives. HTML uses &amp;. When I wrote a regex parser, I made the escape character &#x2F;, making a clear distinction between \n (a raw newline - just character data to the regex parser) and &#x2F;n (an escaped n - special to the regex parser). But somehow every mainstream regex library uses \, gratuitously adding a lot of mental load to figuring out how much escaping you need. String.split(&quot;\\s+&quot;) is a usability failure, not something to be proud of, and definitely not something to imitate. What happened?<p>Imagine you&#x27;re looking for use of a single backslash in some JSON data. It&#x27;ll be escaped, appearing literally in the data as \\.  If (because this is an example to show why sharing escape characters between languages is idiotic) you want to search for it with a regex, you need \\\\. But to get that regex, you need to escape each of those four backslashes yet again, because you construct them from strings. So you&#x27;ve got re.compile(&#x27;\\\\\\\\&#x27;) to match what is notionally a single backslash in the data you&#x27;re searching through. Compare a hypothetical world where \ is the escape character for strings, @ is the escape character for regexes, and + is the escape character for JSON:<p><pre><code>    re.compile(&#x27;++&#x27;) # matches escaped + in the data
    re.compile(&#x27;@@&#x27;) # matches @ in the data
    re.compile(&#x27;\\&#x27;) # matches \ in the data</code></pre>