Skip to content

Commit

Permalink
Merge pull request #17241 from thezackm/chore/add-negate-operator
Browse files Browse the repository at this point in the history
chore: add notes on creating negative lookahead
  • Loading branch information
akristen committed May 9, 2024
2 parents 2ce8f7f + 9c0967b commit d2569b9
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2258,6 +2258,24 @@ The default behavior of this map is an `OR` condition, but you can override this
"!if_Alias": "^Uplink.*"
```
</Collapser>

<Collapser
id="negate-lookup"
title="Create a negative lookahead"
>
Golang's regex package does not support negative lookahead patterns (`q(?!u)`) by default. As a workaround, you can add the `DOES_NOT_MATCH` token to your attribute map to effectively give you the inverse results of your matching pattern.

For example, to match on every interface that **does not** include the string `Uplink`; you can use a configuration like this:

```yaml
devices:
deviceName:
...
match_attributes:
"!if_Alias": "^Uplink.*"
DOES_NOT_MATCH: true
```
</Collapser>
</CollapserGroup>

## The `response_time` and `ping_only` attributes [#response_time-attribute]
Expand Down

0 comments on commit d2569b9

Please sign in to comment.