You can do: `assert_raise Regex.CompileError, %r/position 0$/ instead, fn ...`