Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Regex search examples

Find any vlan with IDs 1020 or 1030:

vlan (1020|1030)

 

Find any vlan in the 10xx range:

vlan 10\d{2}

 

Find any router with OSPF router-id in 10.0.0.0/24

router-id=10.0.0.\d+

 

Regex cheat-sheet

TokenDescription
.any single character
\dany number
\hany horizontal white-space (space, tab, etc.)
TokenDescription
?one or zero times
*any number of times (even zero - zero or more times)
+at least once (one or more times)
{2}Repeats 2 times
TokenDescription
[abc]any of the characters inside ('a' or 'b' or 'c')
[a-z]

any of the characters inside the range (a through z)

|or
()group - for example '(foo|bar)' - 'foo' or 'bar'

Regex search examples

Find any vlan with IDs 1020 or 1030:

vlan (1020|1030)

 

Find any vlan in the 10xx range:

vlan 10\d{2}

 

Find any router with OSPF router-id in 10.0.0.0/24

router-id=10.0.0.\d+