22 lines
421 B
Plaintext
Raw Normal View History

include::../description.adoc[]
To match a literal string, rather than a regular expression, either all special characters should be escaped or methods that don't use regular expressions should be used.
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,javascript]
----
new RegExp("([");
str.match("([");
----
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,javascript]
----
new RegExp("\\(\\[");
str.match("\\(\\[");
str.replace("([", "{");
----