rspec/rules/S5850/rule-jvm.adoc

51 lines
599 B
Plaintext
Raw Normal View History

include::description.adoc[]
=== Noncompliant code example
2022-02-04 17:28:24 +01:00
[source,text]
----
^a|b|c$
----
=== Compliant solution
2022-02-04 17:28:24 +01:00
[source,text]
----
^(?:a|b|c)$
----
or
2022-02-04 17:28:24 +01:00
[source,text]
----
^a$|^b$|^c$
----
or, if you do want the anchors to only apply to ``++a++`` and ``++c++`` respectively:
2022-02-04 17:28:24 +01:00
[source,text]
----
(?:^a)|b|(?:c$)
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Group parts of the regex together to make the intended operator precedence explicit.
=== Highlighting
The entire regex
endif::env-github,rspecator-view[]