== Why is this an issue?

include::../description.adoc[]

=== Noncompliant code example

[source,java]
----
"(?:number)\\d{2}"
----

=== Compliant solution

[source,java]
----
"number\\d{2}"      	// it is anyway required
"(?:number)?\\d{2}"  	// it is in fact optional
----

=== Exceptions

This rule does not report an issue if the non-capturing group is an alternation.

[source,java]
----
"(?:number|string)"
----

include::../implementation.adoc[]
