Skip to content

v-flag \q{...} incorrectly rejects escaped dash \- #1598

Closed

Description

@kid-lxy

QuickJS rejects an escaped dash inside a v-flag \q{...} class string.

Reproducer

var r = new RegExp("[\\q{\\-}]", "v");
print(r.test("-"));

Expected result

The regular expression should compile successfully and print:

true

In Unicode Sets mode, - is a ClassSetReservedPunctuator and is valid when escaped as \- inside \q{...}.

Actual result

QuickJS throws:

SyntaxError: invalid escape sequence in regular expression

QuickJS version
QuickJS version/release: v0.15.1
Operating system: Ubuntu 24.04 x86_64

Activity

  1. saghul commented on Jul 24, 2026

    @saghul
    Contributor

    Can you try latest master?

  2. kid-lxy commented on Jul 25, 2026

    @kid-lxy
    Author

    Can you try latest master?

    I tested it with the latest master commit 3d3cf3d, but the issue still reproduces.

    SyntaxError: invalid escape sequence in regular expression
        at RegExp (native)
        at <anonymous> (/bug/vflag_q_dash_rejected.js:51:13)
    
  3. sr5434 commented on Aug 17, 2026

    @sr5434
    Contributor

    I'm working on a patch and will try to get a PR up when I can

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions