rspec/rules/S5850/php/rule.adoc

36 lines
359 B
Plaintext

== Why is this an issue?
include::../description.adoc[]
=== Noncompliant code example
[source,php]
----
/^a|b|c$/
----
=== Compliant solution
[source,php]
----
/^(?:a|b|c)$/
----
or
[source,php]
----
/^a$|^b$|^c$/
----
or, if you do want the anchors to only apply to ``++a++`` and ``++c++`` respectively:
[source,php]
----
/(?:^a)|b|(?:c$)/
----