Skip to content

matches() function not working correctly!? #1768

Open
@vnvyvu

Description

@vnvyvu

Describe the bug
I use matches() and below regex string to check strong password
myRegEx = (?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[\W]).{8,}/gm

  • send request:
    With password = "Password@123". Result: match myRegEx

  • send request again:
    With password = "Password@123". Result: does not match myRegEx

Examples
My code: https://stackblitz.com/edit/node-mub3gz or https://replit.com/join/mcrsnwazhi-vyvu

first request
image
2nd request
image

Additional context
Validator.js version: 6.12.2
Node.js version: 16.10.0
OS platform: windows

Sorry if it's not a bug!
==> Temporarily I use isStrongPassword() instead of matches()

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