Skip to content

"Range out of order in character class" when trying to match common operators #352

Open
@tommy-mitchell

Description

@tommy-mitchell

I'm trying to build a verbal expression to match common math operators:

new VerEx().anyOf(["+", "-", "*", "/", "^"])

However, arranging the characters in this order yields the error:

Invalid regular expression: /[\+-\*/\^]/: Range out of order in character class

Any other grouping works correctly (e.g, with the - first, third, etc.):

new VerEx().anyOf(["-", "+", "*", "/", "^"])
// VerbalExpression /[-\+\*/\^]/gm

Only the order with the - in the second index fails. Is this a bug?

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