14 lines
353 B
Plaintext
14 lines
353 B
Plaintext
Multiple spaces in a regular expression can make it hard to tell how many spaces should be matched. It's more readable to use only one space and then indicate with a quantifier how many spaces are expected.
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
const pattern = /Hello, world!/;
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
const pattern = /Hello, {3}world!/;
|
|
----
|