Page tree

Versions Compared

Key

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

...

The same three match modes apply when using regex matching condition types. Each regular expression in the input is evaluated against lines in the source, and the match mode governs whether the matches must occur in order and whether intervening unmatched lines are permitted.

Loose Mode

Code Block
languagetext
(?m)^hostname R[0-9]+$
(?m)^interface Ethernet[0-9]+$

This checks for a hostname matching R followed by one or more digits and an Ethernet interface with a numeric identifier. The two matches can occur anywhere in the configuration and in any order.

Sequential Mode

Code Block
languagetext
(?m)^interface Ethernet[0-9]+$
(?m)^ ip address ([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]+$

This verifies that an interface declaration is followed later by an IPv4 address. Other configuration lines may appear between the two matches.

Strict Mode

Code Block
languagetext
(?m)^interface Ethernet[0-9]+$
(?m)^ description .+$
(?m)^ ip address ([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]+$

This verifies that an interface, a description, and an IPv4 address appear as three consecutive lines, in that order.

Choosing the Right Match Mode

...