31 lines
402 B
Plaintext
31 lines
402 B
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,python]
|
|
----
|
|
r"(?:number)\d{2}"
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,python]
|
|
----
|
|
r"number\d{2}"
|
|
r"(?:number)?\d{2}"
|
|
----
|
|
|
|
|
|
=== Exceptions
|
|
|
|
This rule does not report an issue if the non-capturing group is an alternation.
|
|
|
|
[source,python]
|
|
----
|
|
r"(?:number|string)"
|
|
----
|
|
|
|
include::../implementation.adoc[]
|