Go

Go

By DeepSource

Simplify regular expression by using raw string literalSCC-S1007

Anti-pattern
Has Autofix

Raw string literals use backticks (`) instead of quotes (") and thus, do not support any escape sequences. This means that the backslash (\) can be used freely, without the need of escaping.

Since regular expressions have their own escape sequences, raw strings can improve their readability.

Bad pattern:

regexp.Compile("\\A(\\w+) profile: total \\d+\\n\\z")

Good pattern:

regexp.Compile(`\A(\w+) profile: total \d+
\z`)