Skip to content

VBC-096: complex-regex-no-comment

warning

Category: clean-code
Analysis: Regex (line by line)
File types: .js, .ts, .tsx, .astro
Scope: undefined
Tags: clean-code

What it reports

Long regular expression literal at line {line} with no explanation. Add a comment stating what it matches, or build it from named parts.

Flagged

js
const re = /^[a-z0-9]+(?:[-_][a-z0-9]+)*@example\.com$/;

Not flagged

js
const re = /^\d+$/;

Pattern

regex
/(?:[^/\n\\]|\\.){30,}/[dgimsuvy]*

Released under the MIT License.