Regex cheat-sheet
| Token | Description |
|---|---|
| . | any single character |
| \d | any number |
| \h | any horizontal white-space (space, tab, etc.) |
| Token | Description |
|---|---|
| ? | 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 |
| Token | Description |
|---|---|
| [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+