Octal escape sequences, when used in regular expressions, can easily be mistaken for backreferences. When the use of such sequence is intentional, it is generally better to replace them with Unicode or hexadecimal sequence to avoid any ambiguity.

== Why is this an issue?
Using octal escapes in regular expressions can create confusion with backreferences.
Octal escapes are sequences of digits that represent a character in the ASCII table, and they are sometimes used to represent special characters in regular expressions.
However, they can be easily mistaken for backreferences, which are also sequences of digits that represent previously captured groups. This confusion can lead to unexpected results or errors in the regular expression.

== How to fix it
Instead of using octal escapes, it is recommended to use other ways to represent special characters in regular expressions. For example, you can use Unicode escape sequences, hexadecimal escape sequences or character classes. By using these alternatives, you can avoid the confusion with backreferences and improve the readability of your regular expressions.

=== Code examples

==== Noncompliant code example

[source,python]
----
import re

match = re.match(r"\101", "A")
----

==== Compliant solution

[source,python]
----
import re

match = re.match(r"\x41", "A")
----

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

== Message
Consider replacing this octal escape sequence with a Unicode or hexadecimal sequence instead.

== Highlighting

The octal escape sequence

'''

endif::env-github,rspecator-view[]

