rspec/rules/S5856/kotlin/rule.adoc

37 lines
679 B
Plaintext

include::../description.adoc[]
To match a literal string instead of a regular expression, either all special characters should be escaped, the `RegexOption.LITERAL` flag or functions that don't use regular expressions should be used.
== Noncompliant Code Example
----
Regex("([")
"([".toRegex()
----
== Compliant Solution
----
Regex("\\(\\[")
Regex("""\(\[""")
"\\(\\[".toRegex()
"""\(\[""".toRegex()
Regex("([", RegexOption.LITERAL)
"([".toRegex(RegexOption.LITERAL)
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../highlighting.adoc[]
endif::env-github,rspecator-view[]