# Include and exclude pattern

**URL:** https://discuss.elastic.co/t/include-and-exclude-pattern/121455
**Category:** Kibana
**Created:** [February 26, 2018, 8:52am UTC](https://discuss.elastic.co/t/include-and-exclude-pattern/121455 "2018-02-26T08:52:35Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jerrychen](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jerrychen](https://discuss.elastic.co/u/jerrychen)
#### Post date: [February 26, 2018, 8:52am UTC](https://discuss.elastic.co/t/include-and-exclude-pattern/121455/1 "2018-02-26T08:52:35Z")

</div>

I want to filter url which not include ".doc",".zip",".pdf" etc.

I use query: -url.keyword:_.doc OR -url.keywork:_.zip OR -url.keywork:\*.pdf. it works.

When i try the syntax:-url.keywork:\*.(doc|zip|pdf),but it failed.

Is there way to simplify the exclude query syntax?

---

<div class="post-metadata">

### Author: ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)
#### Post date: [February 27, 2018, 8:04pm UTC](https://discuss.elastic.co/t/include-and-exclude-pattern/121455/2 "2018-02-27T20:04:05Z")

</div>

Does `-url.keyword:/.*\.(doc|zip|pdf)/` work for you? I believe above is a combo of a regex and glob style, so going with a full regex should get us moving in the right direction.

---

<div class="post-metadata">

### Author: ![jerrychen](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jerrychen](https://discuss.elastic.co/u/jerrychen)
#### Post date: [March 1, 2018, 9:30am UTC](https://discuss.elastic.co/t/include-and-exclude-pattern/121455/3 "2018-03-01T09:30:53Z")

</div>

it works,thanks a lot.

---

<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: [March 29, 2018, 9:30am UTC](https://discuss.elastic.co/t/include-and-exclude-pattern/121455/4 "2018-03-29T09:30:53Z")

</div>

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