# Query Match text starting with exclamation mark (!)

**URL:** <https://discuss.elastic.co/t/query-match-text-starting-with-exclamation-mark/89237>\
**Category:** Kibana\
**Created:** [June 13, 2017, 4:22pm UTC](https://discuss.elastic.co/t/query-match-text-starting-with-exclamation-mark/89237 "2017-06-13T16:22:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![smlbiobot](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smlbiobot/32/29622_2.png) [@smlbiobot](https://discuss.elastic.co/u/smlbiobot)\
**Post date:** [June 13, 2017, 4:22pm UTC](https://discuss.elastic.co/t/query-match-text-starting-with-exclamation-mark/89237/1 "2017-06-13T16:22:18Z")

</div>

Hi,

I am trying to look for values in a free form text field which may start with the exclamation mark (!) and exclude it from the results. But I can’t figure out what to put in the query input in the Kibana Discover.

I have tried:

```
content:/\!.+/

```

I have also tried using filters syntax:

```
{
  "query": {
    "regexp": {
      "content": {
        "value": "\!.+"
      }
    }
  }
}

```

no errors. Just no results found. Can you help?

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [June 13, 2017, 4:55pm UTC](https://discuss.elastic.co/t/query-match-text-starting-with-exclamation-mark/89237/2 "2017-06-13T16:55:07Z")

</div>

Hey @smlbiobot is the `content` field currently "analyzed"? The standard analyzer in Elasticsearch will remove the `!` from the resultant tokens which might be adding to the complexity.

If you have a "keyword" multi-field that isn't analyzed, you should be able to do this following: `!content.keyword:\!*`

---

<div class="post-metadata">

**Author:** ![smlbiobot](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smlbiobot/32/29622_2.png) [@smlbiobot](https://discuss.elastic.co/u/smlbiobot)\
**Post date:** [June 13, 2017, 4:57pm UTC](https://discuss.elastic.co/t/query-match-text-starting-with-exclamation-mark/89237/3 "2017-06-13T16:57:16Z")

</div>

Oh sweet! That works like magic. Thanks so much!

---

<div class="post-metadata">

**Author:** ![smlbiobot](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smlbiobot/32/29622_2.png) [@smlbiobot](https://discuss.elastic.co/u/smlbiobot)\
**Post date:** [June 13, 2017, 5:07pm UTC](https://discuss.elastic.co/t/query-match-text-starting-with-exclamation-mark/89237/4 "2017-06-13T17:07:53Z")

</div>

@Brandon_Kobel ok and say if I want to create filter OR use something like that in Visualize, is there a way to store it somewhere and give it a name? Is this something I would do in scripted filters? And if it is, how would I type that?

---

<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:** [July 11, 2017, 5:07pm UTC](https://discuss.elastic.co/t/query-match-text-starting-with-exclamation-mark/89237/5 "2017-07-11T17:07:56Z")

</div>

Closed on July 11, 2017, 5:07pm UTC

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