22 lines
336 B
Plaintext
22 lines
336 B
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
str.split(/.*?x?/); // Noncompliant, this will behave just like "x?"
|
|
/^.*?$/.test(str); // Noncompliant, replace with ".*"
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
str.split(/.*?x/);
|
|
/^.*$/.test(str);
|
|
----
|
|
|