Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Golang

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

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 - 2 years ago