Skip to content

.matches failing when passing regex instead of pattern #1127

@KikoCosmetics

Description

@KikoCosmetics

Describe the bug

It appears that passing a regex causes the validation to fail sometimes

Here's the typings just to show that regexps are allowed:

image

To Reproduce

FAILS

image

image

image

FAILS
image

PASSES
image

Expected behavior

The validation should always pass or always fail

Current behavior

The validation fails sometime (it shouldn't)

Environment:

  • Express-validator version: 6.13.0
  • Express version: 4.17.1
  • Node 14.18.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions