0

I am creating an app with NodeJS, which would require users entering valid VLAN ID's. I have successfully created a regex that would match 4 digits, including a comma but no range yet. So far, I have .matches(/^(\d{1,4},)*\d{1,4}$/).withMessage('Invalid Vlans Entered') and this would only check for 4 digits with a comma. I am trying to create a regex that would match just about the main requirements for a valid vlan ID, with the following: Not greater than 4094, allowed character should be comma and a hyphen (incase a user specifies a vlan range). I have tried all forms of regex combo, but it doesn't work as expected. Any help at this point would be great. I am using express-validator to validate input.

tubostic
  • 5
  • 1

0 Answers0