---
source: crates/ruff_linter/src/rules/ruff/mod.rs
---
RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:8:43
   |
 6 |     ### Errors
 7 |
 8 |     with pytest.raises(FooAtTheEnd, match="foo."): ...
   |                                           ^^^^^^
 9 |     with pytest.raises(PackageExtraSpecifier, match="Install `foo[bar]` to enjoy all features"): ...
10 |     with pytest.raises(InnocentQuestion, match="Did you mean to use `Literal` instead?"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:9:53
   |
 8 |     with pytest.raises(FooAtTheEnd, match="foo."): ...
 9 |     with pytest.raises(PackageExtraSpecifier, match="Install `foo[bar]` to enjoy all features"): ...
   |                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10 |     with pytest.raises(InnocentQuestion, match="Did you mean to use `Literal` instead?"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:10:48
   |
 8 |     with pytest.raises(FooAtTheEnd, match="foo."): ...
 9 |     with pytest.raises(PackageExtraSpecifier, match="Install `foo[bar]` to enjoy all features"): ...
10 |     with pytest.raises(InnocentQuestion, match="Did you mean to use `Literal` instead?"): ...
   |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 |
12 |     with pytest.raises(StringConcatenation, match="Huh"
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:12:51
   |
10 |       with pytest.raises(InnocentQuestion, match="Did you mean to use `Literal` instead?"): ...
11 |
12 |       with pytest.raises(StringConcatenation, match="Huh"
   |  ___________________________________________________^
13 | |                                                   "?"): ...
   | |_____________________________________________________^
14 |       with pytest.raises(ManuallyEscapedWindowsPathToDotFile, match="C:\\\\Users\\\\Foo\\\\.config"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:14:67
   |
12 |     with pytest.raises(StringConcatenation, match="Huh"
13 |                                                   "?"): ...
14 |     with pytest.raises(ManuallyEscapedWindowsPathToDotFile, match="C:\\\\Users\\\\Foo\\\\.config"): ...
   |                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15 |
16 |     with pytest.raises(MiddleDot, match="foo.bar"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:16:41
   |
14 |     with pytest.raises(ManuallyEscapedWindowsPathToDotFile, match="C:\\\\Users\\\\Foo\\\\.config"): ...
15 |
16 |     with pytest.raises(MiddleDot, match="foo.bar"): ...
   |                                         ^^^^^^^^^
17 |     with pytest.raises(EndDot, match="foobar."): ...
18 |     with pytest.raises(EscapedFollowedByUnescaped, match="foo\\.*bar"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:17:38
   |
16 |     with pytest.raises(MiddleDot, match="foo.bar"): ...
17 |     with pytest.raises(EndDot, match="foobar."): ...
   |                                      ^^^^^^^^^
18 |     with pytest.raises(EscapedFollowedByUnescaped, match="foo\\.*bar"): ...
19 |     with pytest.raises(UnescapedFollowedByEscaped, match="foo.\\*bar"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:18:58
   |
16 |     with pytest.raises(MiddleDot, match="foo.bar"): ...
17 |     with pytest.raises(EndDot, match="foobar."): ...
18 |     with pytest.raises(EscapedFollowedByUnescaped, match="foo\\.*bar"): ...
   |                                                          ^^^^^^^^^^^^
19 |     with pytest.raises(UnescapedFollowedByEscaped, match="foo.\\*bar"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:19:58
   |
17 |     with pytest.raises(EndDot, match="foobar."): ...
18 |     with pytest.raises(EscapedFollowedByUnescaped, match="foo\\.*bar"): ...
19 |     with pytest.raises(UnescapedFollowedByEscaped, match="foo.\\*bar"): ...
   |                                                          ^^^^^^^^^^^^
20 |
21 |     # https://github.com/astral-sh/ruff/issues/15316
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:22:50
   |
21 |     # https://github.com/astral-sh/ruff/issues/15316
22 |     with pytest.raises(ClosingParenthesis, match="foo)"): ...
   |                                                  ^^^^^^
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:27:44
   |
25 |     ## Metasequences
26 |
27 |     with pytest.raises(StartOfInput, match="foo\\Abar"): ...
   |                                            ^^^^^^^^^^^
28 |     with pytest.raises(WordBoundary, match="foo\\bbar"): ...
29 |     with pytest.raises(NonWordBoundary, match="foo\\Bbar"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:28:44
   |
27 |     with pytest.raises(StartOfInput, match="foo\\Abar"): ...
28 |     with pytest.raises(WordBoundary, match="foo\\bbar"): ...
   |                                            ^^^^^^^^^^^
29 |     with pytest.raises(NonWordBoundary, match="foo\\Bbar"): ...
30 |     with pytest.raises(Digit, match="foo\\dbar"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:29:47
   |
27 |     with pytest.raises(StartOfInput, match="foo\\Abar"): ...
28 |     with pytest.raises(WordBoundary, match="foo\\bbar"): ...
29 |     with pytest.raises(NonWordBoundary, match="foo\\Bbar"): ...
   |                                               ^^^^^^^^^^^
30 |     with pytest.raises(Digit, match="foo\\dbar"): ...
31 |     with pytest.raises(NonDigit, match="foo\\Dbar"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:30:37
   |
28 |     with pytest.raises(WordBoundary, match="foo\\bbar"): ...
29 |     with pytest.raises(NonWordBoundary, match="foo\\Bbar"): ...
30 |     with pytest.raises(Digit, match="foo\\dbar"): ...
   |                                     ^^^^^^^^^^^
31 |     with pytest.raises(NonDigit, match="foo\\Dbar"): ...
32 |     with pytest.raises(Whitespace, match="foo\\sbar"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:31:40
   |
29 |     with pytest.raises(NonWordBoundary, match="foo\\Bbar"): ...
30 |     with pytest.raises(Digit, match="foo\\dbar"): ...
31 |     with pytest.raises(NonDigit, match="foo\\Dbar"): ...
   |                                        ^^^^^^^^^^^
32 |     with pytest.raises(Whitespace, match="foo\\sbar"): ...
33 |     with pytest.raises(NonWhitespace, match="foo\\Sbar"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:32:42
   |
30 |     with pytest.raises(Digit, match="foo\\dbar"): ...
31 |     with pytest.raises(NonDigit, match="foo\\Dbar"): ...
32 |     with pytest.raises(Whitespace, match="foo\\sbar"): ...
   |                                          ^^^^^^^^^^^
33 |     with pytest.raises(NonWhitespace, match="foo\\Sbar"): ...
34 |     with pytest.raises(WordCharacter, match="foo\\wbar"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:33:45
   |
31 |     with pytest.raises(NonDigit, match="foo\\Dbar"): ...
32 |     with pytest.raises(Whitespace, match="foo\\sbar"): ...
33 |     with pytest.raises(NonWhitespace, match="foo\\Sbar"): ...
   |                                             ^^^^^^^^^^^
34 |     with pytest.raises(WordCharacter, match="foo\\wbar"): ...
35 |     with pytest.raises(NonWordCharacter, match="foo\\Wbar"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:34:45
   |
32 |     with pytest.raises(Whitespace, match="foo\\sbar"): ...
33 |     with pytest.raises(NonWhitespace, match="foo\\Sbar"): ...
34 |     with pytest.raises(WordCharacter, match="foo\\wbar"): ...
   |                                             ^^^^^^^^^^^
35 |     with pytest.raises(NonWordCharacter, match="foo\\Wbar"): ...
36 |     with pytest.raises(EndOfInput, match="foo\\zbar"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:35:48
   |
33 |     with pytest.raises(NonWhitespace, match="foo\\Sbar"): ...
34 |     with pytest.raises(WordCharacter, match="foo\\wbar"): ...
35 |     with pytest.raises(NonWordCharacter, match="foo\\Wbar"): ...
   |                                                ^^^^^^^^^^^
36 |     with pytest.raises(EndOfInput, match="foo\\zbar"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:36:42
   |
34 |     with pytest.raises(WordCharacter, match="foo\\wbar"): ...
35 |     with pytest.raises(NonWordCharacter, match="foo\\Wbar"): ...
36 |     with pytest.raises(EndOfInput, match="foo\\zbar"): ...
   |                                          ^^^^^^^^^^^
37 |
38 |     with pytest.raises(StartOfInput2, match="foobar\\A"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:38:45
   |
36 |     with pytest.raises(EndOfInput, match="foo\\zbar"): ...
37 |
38 |     with pytest.raises(StartOfInput2, match="foobar\\A"): ...
   |                                             ^^^^^^^^^^^
39 |     with pytest.raises(WordBoundary2, match="foobar\\b"): ...
40 |     with pytest.raises(NonWordBoundary2, match="foobar\\B"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:39:45
   |
38 |     with pytest.raises(StartOfInput2, match="foobar\\A"): ...
39 |     with pytest.raises(WordBoundary2, match="foobar\\b"): ...
   |                                             ^^^^^^^^^^^
40 |     with pytest.raises(NonWordBoundary2, match="foobar\\B"): ...
41 |     with pytest.raises(Digit2, match="foobar\\d"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:40:48
   |
38 |     with pytest.raises(StartOfInput2, match="foobar\\A"): ...
39 |     with pytest.raises(WordBoundary2, match="foobar\\b"): ...
40 |     with pytest.raises(NonWordBoundary2, match="foobar\\B"): ...
   |                                                ^^^^^^^^^^^
41 |     with pytest.raises(Digit2, match="foobar\\d"): ...
42 |     with pytest.raises(NonDigit2, match="foobar\\D"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:41:38
   |
39 |     with pytest.raises(WordBoundary2, match="foobar\\b"): ...
40 |     with pytest.raises(NonWordBoundary2, match="foobar\\B"): ...
41 |     with pytest.raises(Digit2, match="foobar\\d"): ...
   |                                      ^^^^^^^^^^^
42 |     with pytest.raises(NonDigit2, match="foobar\\D"): ...
43 |     with pytest.raises(Whitespace2, match="foobar\\s"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:42:41
   |
40 |     with pytest.raises(NonWordBoundary2, match="foobar\\B"): ...
41 |     with pytest.raises(Digit2, match="foobar\\d"): ...
42 |     with pytest.raises(NonDigit2, match="foobar\\D"): ...
   |                                         ^^^^^^^^^^^
43 |     with pytest.raises(Whitespace2, match="foobar\\s"): ...
44 |     with pytest.raises(NonWhitespace2, match="foobar\\S"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:43:43
   |
41 |     with pytest.raises(Digit2, match="foobar\\d"): ...
42 |     with pytest.raises(NonDigit2, match="foobar\\D"): ...
43 |     with pytest.raises(Whitespace2, match="foobar\\s"): ...
   |                                           ^^^^^^^^^^^
44 |     with pytest.raises(NonWhitespace2, match="foobar\\S"): ...
45 |     with pytest.raises(WordCharacter2, match="foobar\\w"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:44:46
   |
42 |     with pytest.raises(NonDigit2, match="foobar\\D"): ...
43 |     with pytest.raises(Whitespace2, match="foobar\\s"): ...
44 |     with pytest.raises(NonWhitespace2, match="foobar\\S"): ...
   |                                              ^^^^^^^^^^^
45 |     with pytest.raises(WordCharacter2, match="foobar\\w"): ...
46 |     with pytest.raises(NonWordCharacter2, match="foobar\\W"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:45:46
   |
43 |     with pytest.raises(Whitespace2, match="foobar\\s"): ...
44 |     with pytest.raises(NonWhitespace2, match="foobar\\S"): ...
45 |     with pytest.raises(WordCharacter2, match="foobar\\w"): ...
   |                                              ^^^^^^^^^^^
46 |     with pytest.raises(NonWordCharacter2, match="foobar\\W"): ...
47 |     with pytest.raises(EndOfInput2, match="foobar\\z"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:46:49
   |
44 |     with pytest.raises(NonWhitespace2, match="foobar\\S"): ...
45 |     with pytest.raises(WordCharacter2, match="foobar\\w"): ...
46 |     with pytest.raises(NonWordCharacter2, match="foobar\\W"): ...
   |                                                 ^^^^^^^^^^^
47 |     with pytest.raises(EndOfInput2, match="foobar\\z"): ...
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:47:43
   |
45 |     with pytest.raises(WordCharacter2, match="foobar\\w"): ...
46 |     with pytest.raises(NonWordCharacter2, match="foobar\\W"): ...
47 |     with pytest.raises(EndOfInput2, match="foobar\\z"): ...
   |                                           ^^^^^^^^^^^
   |
help: Use a raw string or `re.escape()` to make the intention explicit

RUF043 Pattern passed to `match=` contains metacharacters but is neither escaped nor raw
  --> RUF043.py:52:42
   |
50 |     ### Acceptable false positives
51 |
52 |     with pytest.raises(NameEscape, match="\\N{EN DASH}"): ...
   |                                          ^^^^^^^^^^^^^^
   |
help: Use a raw string or `re.escape()` to make the intention explicit
