# Regexp filter elasticsearch 1.7 not working as expected

**URL:** <https://discuss.elastic.co/t/regexp-filter-elasticsearch-1-7-not-working-as-expected/34869>\
**Category:** Elasticsearch\
**Created:** [November 18, 2015, 1:11am UTC](https://discuss.elastic.co/t/regexp-filter-elasticsearch-1-7-not-working-as-expected/34869 "2015-11-18T01:11:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Siddartha\_Guthikonda](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@Siddartha\_Guthikonda](https://discuss.elastic.co/u/Siddartha_Guthikonda)\
**Post date:** [November 18, 2015, 1:11am UTC](https://discuss.elastic.co/t/regexp-filter-elasticsearch-1-7-not-working-as-expected/34869/1 "2015-11-18T01:11:12Z")

</div>

I am trying to use a regex filter to do a match all strings except a string.

My regexp is [^(hello)].

I don't get any responses back. I do see there are documents which match this regex.

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [November 18, 2015, 11:17am UTC](https://discuss.elastic.co/t/regexp-filter-elasticsearch-1-7-not-working-as-expected/34869/2 "2015-11-18T11:17:42Z")

</div>

I think your regex might not be correct. As far as I can see it matches any character not in the list (helo), so it will return documents with terms like "a" or "x". Having said that, using regex query to get documents not matching anything might not be the right approach. Have you tried using `bool` query with a `must_not` clause?

---

<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 5, 2017, 11:37pm UTC](https://discuss.elastic.co/t/regexp-filter-elasticsearch-1-7-not-working-as-expected/34869/3 "2017-07-05T23:37:40Z")

</div>


