34 lines
499 B
Plaintext
34 lines
499 B
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,php]
|
|
----
|
|
"(?:number)\d{2}"
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,php]
|
|
----
|
|
"number\d{2}"
|
|
"(?:number)?\d{2}"
|
|
----
|
|
|
|
=== Exceptions
|
|
|
|
This rule does not report an issue if the non-capturing group is an alternation.
|
|
|
|
[source,php]
|
|
----
|
|
"(?:number|string)"
|
|
----
|
|
|
|
== Resources
|
|
|
|
https://www.php.net/manual/en/regexp.reference.subpatterns.php[Subpatterns] - PHP Documentation
|
|
|
|
include::../implementation.adoc[]
|