Skip to content

isMACAddress support for macAddressWithDots might be incorrect #1614

@simonfan

Description

@simonfan

Describe the bug
isMACAddress(str) might be using an incorrect RegExp for testing MAC address with dots. I might be wrong, have no experience at all using MAC addresses, was just browsing the code.

The pull request that introduced the support for MAC address with dots specifically intended to support 0102.0304.05ab, but the RegExp used is:

const macAddressWithDots = /^([0-9a-fA-F]{4}).([0-9a-fA-F]{4}).([0-9a-fA-F]{4})$/;
https://github.com/validatorjs/validator.js/blob/master/src/lib/isMACAddress.js#L7

Examples
The dots (.) allow for any character to work as separator
0102X0304X05ab
0102 0304 05ab
0102/0304/05ab

Additional context
Validator.js version: 13.5.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