Skip to content

no-invalid-regexp: some v-mode regexes are marked invalid when actually valid, e.g. /[\p{N}--0]/gv #1442

@lionel-rowe

Description

@lionel-rowe

Some v-mode regexes are marked invalid when actually valid, such as a character class subtracted from a bare Unicode property character class.

Lint Name

no-invalid-regexp

Code Snippet

// Lint error "Invalid RegExp literal: Rework regular expression to be a valid deno-lint(no-invalid-regexp)"
const re = /[\p{N}--0]/gv;
// works fine at runtime, logging ['1', '2', '3'] as expected
console.log('1203'.match(re));
// identical semantics and runtime behavior, redundant brackets around unicode property eliminate the lint error
const re2 = /[[\p{N}]--0]/gv;

Expected Result

No lint error for regexes like /[\p{N}--0]/gv

Actual Result

Lint error

Additional Info

N/A

Version

deno 2.3.3 (stable, release, x86_64-unknown-linux-gnu)
v8 13.7.152.6-rusty
typescript 5.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions