When an alternation contains multiple alternatives that consist of a single character, it can be rewritten as a character class. This should be preferred because it is more efficient and can even help prevent stack overflows when used inside a repetition (see rule {rule:javascript:S5998}).

Noncompliant Code Example

/a|b|c/; // Noncompliant

Compliant Solution

/[abc]/;
// or
/[a-c]/;