2021-11-03 17:52:55 +01:00
|
|
|
include::description.adoc[]
|
|
|
|
|
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
=== Noncompliant code example
|
2021-11-03 17:52:55 +01:00
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,text]
|
2021-11-03 17:52:55 +01:00
|
|
|
----
|
|
|
|
^a|b|c$
|
|
|
|
----
|
|
|
|
|
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
=== Compliant solution
|
2021-11-03 17:52:55 +01:00
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,text]
|
2021-11-03 17:52:55 +01:00
|
|
|
----
|
|
|
|
^(?:a|b|c)$
|
|
|
|
----
|
|
|
|
|
|
|
|
or
|
|
|
|
|
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,text]
|
2021-11-03 17:52:55 +01:00
|
|
|
----
|
|
|
|
^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]
|
2021-11-03 17:52:55 +01:00
|
|
|
----
|
|
|
|
(?:^a)|b|(?:c$)
|
|
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
2023-05-25 14:18:12 +02:00
|
|
|
=== Message
|
|
|
|
|
|
|
|
Group parts of the regex together to make the intended operator precedence explicit.
|
|
|
|
|
|
|
|
|
|
|
|
=== Highlighting
|
|
|
|
|
|
|
|
The entire regex
|
2021-11-03 17:52:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|