# Ignoring phrases or using negative lookbehind in regexp

**URL:** <https://discuss.elastic.co/t/ignoring-phrases-or-using-negative-lookbehind-in-regexp/33573>\
**Category:** Elasticsearch\
**Created:** [November 2, 2015, 10:39pm UTC](https://discuss.elastic.co/t/ignoring-phrases-or-using-negative-lookbehind-in-regexp/33573 "2015-11-02T22:39:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andyofb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andyofb/32/5595_2.png) [@andyofb](https://discuss.elastic.co/u/andyofb)\
**Post date:** [November 2, 2015, 10:39pm UTC](https://discuss.elastic.co/t/ignoring-phrases-or-using-negative-lookbehind-in-regexp/33573/1 "2015-11-02T22:39:10Z")

</div>

Is it possible to do a negative look behind in regexp query or filter? There may also be a better way to do this so I am open to suggestions.

I would like to match the word **maps** but not the term **apple maps**.

If it only contains **apple maps** it should **NOT** match.  
If it contains **apple maps** and **maps** it **SHOULD** match.  
If it contains **maps** it **SHOULD** match.

The regular expression equivalent I believe should be something like:

```
(?<!apple )maps

```

Search examples

* * *

```
Apple maps could be better.

```

This **should not** match

* * *

```
I like apple maps more than google maps.

```

This **should** match

* * *

```
Maps are fun.

```

This **should** match

* * *

Any suggestions are greatly appreciated.

---

<div class="post-metadata">

**Author:** ![andyofb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andyofb/32/5595_2.png) [@andyofb](https://discuss.elastic.co/u/andyofb)\
**Post date:** [November 2, 2015, 11:33pm UTC](https://discuss.elastic.co/t/ignoring-phrases-or-using-negative-lookbehind-in-regexp/33573/2 "2015-11-02T23:33:30Z")

</div>

Would this is possible with scoring? If **apple maps** could somehow have no impact on the result.

---

<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:41pm UTC](https://discuss.elastic.co/t/ignoring-phrases-or-using-negative-lookbehind-in-regexp/33573/3 "2017-07-05T23:41:09Z")

</div>


