29 lines
372 B
Plaintext
29 lines
372 B
Plaintext
![]() |
include::../desciption.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[]
|