# Matching a Dollar Sign with a Wildcard using KQL

**URL:** https://discuss.elastic.co/t/matching-a-dollar-sign-with-a-wildcard-using-kql/258819
**Category:** Kibana
**Tags:** kql-kibana-query-language
**Created:** [December 16, 2020, 8:35am UTC](https://discuss.elastic.co/t/matching-a-dollar-sign-with-a-wildcard-using-kql/258819 "2020-12-16T08:35:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![hpicass0](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hpicass0/32/75318_2.png) [@hpicass0](https://discuss.elastic.co/u/hpicass0)
#### Post date: [December 16, 2020, 8:35am UTC](https://discuss.elastic.co/t/matching-a-dollar-sign-with-a-wildcard-using-kql/258819/1 "2020-12-16T08:35:45Z")

</div>

Hi,

Hoping you guys are safe and well  
I'm trying to exclude any username that has `$` at the end of it using Kibnana Query Language  
I've done a lot of testing with the following, but it doesn't seem to work

> and not user.name: \*$

Is there anyway to achieve that? I've tried to escape the `$` by using `/$` or `$ but that's not working as well

Thanks

Hosam,

---

<div class="post-metadata">

### Author: ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)
#### Post date: [December 16, 2020, 12:43pm UTC](https://discuss.elastic.co/t/matching-a-dollar-sign-with-a-wildcard-using-kql/258819/2 "2020-12-16T12:43:18Z")

</div>

Hey @hpicass0,

I think I'll need more information to help you.

I tried with the following dataset, and I was able to use the `$` as part of a wildcard filter:

```auto
PUT /test
{
  "mappings": {
    "properties": {
      "@timestamp":{
        "type":"date"
      },
      "interface":{
        "type":"keyword"
      },
      "hostname":{
        "type":"keyword"
      },
      "metric":{
        "type":"integer"
      }
    }
  }
}

PUT /test/_doc/1
{
  "@timestamp":"2020-12-13T14:54:00",
  "interface":"eth0",
  "hostname":"hostX",
  "metric":20
}

PUT /test/_doc/2
{
  "@timestamp":"2020-12-13T14:55:00",
  "interface":"eth0",
  "hostname":"hostX",
  "metric":60
}

PUT /test/_doc/3
{
  "@timestamp":"2020-12-13T14:54:00",
  "interface":"eth0",
  "hostname":"hostZ",
  "metric":100
}

PUT /test/_doc/4
{
  "@timestamp":"2020-12-13T14:55:00",
  "interface":"eth0",
  "hostname":"hostZ",
  "metric":110
}

PUT /test/_doc/5
{
  "@timestamp":"2020-12-13T14:54:00",
  "interface":"eth1",
  "hostname":"hostZ",
  "metric":10
}

PUT /test/_doc/6
{
  "@timestamp":"2020-12-13T14:54:00",
  "interface":"eth1",
  "hostname":"hostZ",
  "metric":60
}

PUT /test/_doc/7
{
  "@timestamp":"2020-12-13T14:54:00",
  "interface":"eth1$",
  "hostname":"hostZ",
  "metric":60
}

```

Filter: `not interface : *$`

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/2/e245ace31d5819a8c0ecad5151593a196c85ec3e.png)

Are there potentially other parts of your query that are including this document? As a test, can you write your filter to only check against `user.name` and no other field?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [January 13, 2021, 12:43pm UTC](https://discuss.elastic.co/t/matching-a-dollar-sign-with-a-wildcard-using-kql/258819/3 "2021-01-13T12:43:41Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
