# Regex in query bar - get results for strings that don't start with '/'

**URL:** <https://discuss.elastic.co/t/regex-in-query-bar-get-results-for-strings-that-dont-start-with/143702>\
**Category:** Kibana\
**Created:** [August 9, 2018, 1:09pm UTC](https://discuss.elastic.co/t/regex-in-query-bar-get-results-for-strings-that-dont-start-with/143702 "2018-08-09T13:09:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin854](https://avatars.discourse-cdn.com/v4/letter/k/b3f665/32.png) [@Kevin854](https://discuss.elastic.co/u/Kevin854)\
**Post date:** [August 9, 2018, 1:09pm UTC](https://discuss.elastic.co/t/regex-in-query-bar-get-results-for-strings-that-dont-start-with/143702/1 "2018-08-09T13:09:42Z")

</div>

I'm trying to filter out all products that start with a forward slash. Is there a way to do this with the query bar?

My field: i.Product Code/UPC.keyword

I've been trying: "i.Product Code/UPC.keyword"=/(?!/)\*/ but that doesn't seem to filter anything out.

Also, I'm a little confused as to when I should use an = or a : in my query bar formula ... the : always seems to give me an error. Is it because I have spaces in my field name?

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [August 9, 2018, 7:46pm UTC](https://discuss.elastic.co/t/regex-in-query-bar-get-results-for-strings-that-dont-start-with/143702/2 "2018-08-09T19:46:12Z")

</div>

`/` is a special character in regex so it may need to be escaped. Use `\` to escape characters.

Here is a link to the [query syntax documenation](https://www.elastic.co/guide/en/elasticsearch/reference/master/query-dsl-query-string-query.html#query-string-syntax). That should clear up when to use `:` versus `=`.

---

<div class="post-metadata">

**Author:** ![Kevin854](https://avatars.discourse-cdn.com/v4/letter/k/b3f665/32.png) [@Kevin854](https://discuss.elastic.co/u/Kevin854)\
**Post date:** [August 9, 2018, 8:58pm UTC](https://discuss.elastic.co/t/regex-in-query-bar-get-results-for-strings-that-dont-start-with/143702/3 "2018-08-09T20:58:42Z")

</div>

Thanks, Nathan, that does clear things up a little.

Still, I'm not getting anything with this regex to find values that do not start with the number 7

i.Product\ Code/UPC.keyword:/^(?!7).+/

Anything I might be missing with this syntax?

Thanks!

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [August 9, 2018, 9:21pm UTC](https://discuss.elastic.co/t/regex-in-query-bar-get-results-for-strings-that-dont-start-with/143702/4 "2018-08-09T21:21:09Z")

</div>

Try fine tuning your regex outside of Kibana/Elastic since those can be complicated enough to debug. I like to use [https://regex101.com/](https://regex101.com/) when building regexes

---

<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:** [September 6, 2018, 9:21pm UTC](https://discuss.elastic.co/t/regex-in-query-bar-get-results-for-strings-that-dont-start-with/143702/5 "2018-09-06T21:21:12Z")

</div>

Closed on September 6, 2018, 9:21pm UTC

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