Community Patterns

Community Library Entry

0

Regular Expression
Created·2022-12-09 13:32
Flavor·Golang

`
^(409[0-6]|(40[0-8]|[1-3]\d\d|[1-9]\d|[1-9])\d|[1-9])$
`
gm
Open regex in editor

Description

VLAN ID Validation Regex

Please use first segment or second depending on the Extended VLAN usage such as "1-256" or "1-4096" :

  • Non-extended VLAN IDs (1-256), check v2 of the regex entry

^(25[0-6]|(2[0-4]|1\d|[1-9])\d|[1-9])$

  • Extended VLAN IDs (1-4096), check v3 of the regex entry

^(409[0-6]|(40[0-8]|[1-3]\d\d|[1-9]\d|[1-9])\d|[1-9])$

Submitted by ulgena