# Negative matcher

**URL:** <https://discuss.prometheus.io/t/negative-matcher/591>\
**Category:** General Help/Support\
**Created:** [November 10, 2021, 4:36am UTC](https://discuss.prometheus.io/t/negative-matcher/591 "2021-11-10T04:36:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chewy](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@chewy](https://discuss.prometheus.io/u/chewy)\
**Post date:** [November 10, 2021, 4:36am UTC](https://discuss.prometheus.io/t/negative-matcher/591/1 "2021-11-10T04:36:03Z")

</div>

Hi,

How do I write a negative matcher, matching multiple conditions?

Currently, I have alerts with conditions on hashes.  
However, I want to silence the alerts, if the hash do not match particular values.

For example,  
If hash doesn’t match 0x0…1 and it also doesn’t match 0x0…2, I want the alert to go through.

So, in my AlertManager, I have this silence defined:  
keyhash!~"(0x0000000000000000000000000000000000000000000000000000000000000001|0x0000000000000000000000000000000000000000000000000000000000000002)"

But this silences even hash with values such as 8901 or 7890.

How do I write the expression such that it will only silence hashes that doesn’t match 0x…01 and also doesn’t match 0x0…2?

If that’s not feasible, how would I write a silence that will do what I want?

---

<div class="post-metadata">

**Author:** ![roidelapluie](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.prometheus.io/roidelapluie/32/6_2.png) [@roidelapluie](https://discuss.prometheus.io/u/roidelapluie)\
**Post date:** [November 16, 2021, 12:51pm UTC](https://discuss.prometheus.io/t/negative-matcher/591/3 "2021-11-16T12:51:04Z")

</div>

It seems that you have the _invert_ matcher.

keyhash=~"(0x0000000000000000000000000000000000000000000000000000000000000001|0x0000000000000000000000000000000000000000000000000000000000000002)"

is what you want
