<p>While it's <a href="https://arxiv.org/pdf/0907.5058.pdf" rel="noreferrer">possible to decide whether two regular expressions accept the same language</a>, it seems to be rather complicated and not all that terribly useful for everyday regex usage. Therefore, equality on compiled regex patterns is just referential equality:</p>

<pre><code>val x = "abc".r
val y = "abc".r
x == y
// res0: Boolean = false
</code></pre>
Regex pattern equality
<p>In ScalaTest, I have the following check:</p>

<pre><code>"abc".r shouldBe "abc".r
</code></pre>

<p>But it is not equal. I don't understand.</p>

<pre><code>abc was not equal to abc
ScalaTestFailureLocation: com.ing.cybrct.flink.clickstream.ConfigsTest$$anonfun$6 at (ConfigsTest.scala:97)
Expected :abc
Actual   :abc
</code></pre>