rspec/rules/S5869/kotlin/rule.adoc
2022-02-04 16:28:24 +00:00

31 lines
598 B
Plaintext

include::../description.adoc[]
== Noncompliant Code Example
[source,kotlin]
----
Regex("[0-99]") // Noncompliant, this won't actually match strings with two digits
Regex("[0-9.-_]") // Noncompliant, .-_ is a range that already contains 0-9 (as well as various other characters such as capital letters)
----
== Compliant Solution
[source,kotlin]
----
Regex("[0-9]{1,2}")
Regex("[0-9.\\-_]")
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../highlighting.adoc[]
endif::env-github,rspecator-view[]