# Regex Query Not Working

**URL:** <https://discuss.elastic.co/t/regex-query-not-working/68503>\
**Category:** Kibana\
**Created:** [December 9, 2016, 3:45am UTC](https://discuss.elastic.co/t/regex-query-not-working/68503 "2016-12-09T03:45:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maxwell\_Flanders](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Maxwell\_Flanders](https://discuss.elastic.co/u/Maxwell_Flanders)\
**Post date:** [December 9, 2016, 3:45am UTC](https://discuss.elastic.co/t/regex-query-not-working/68503/1 "2016-12-09T03:45:04Z")

</div>

I'm trying to write a regex query for a log that I know exists, and I was wondering if anyone could help me figure out why it is not functioning ( I am 99.999% sure that the regex is correct.)

Normal Query (to prove log exists):  
LOG\_MESSAGE: "Event type"

Result:

 ![](https://us1.discourse-cdn.com/elastic/original/2X/b/b8b383210129257d345f5a2028f5c0ab535ab9ca.jpg)

Regex Query:  
LOG\_MESSAGE: /Event\stype:\s.\*\ssize:\s[0-9]{3,}/

Returns no result.

I have checked the string in the lower logs for leading/trailing whitespace and there are none, so as far as I can tell, this regex should match the later logs at least. Am I missing something in the syntax here? I have no idea what could be going on here.

Thanks!

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [December 9, 2016, 5:36pm UTC](https://discuss.elastic.co/t/regex-query-not-working/68503/2 "2016-12-09T17:36:42Z")

</div>

`type` != `Type`

You'll need to make the regexp case insensitive by adding an `i` at the end. Try using:

`LOG_MESSAGE: /Event\stype:\s.*\ssize:\s[0-9]{3,}/i`

---

<div class="post-metadata">

**Author:** ![Maxwell\_Flanders](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Maxwell\_Flanders](https://discuss.elastic.co/u/Maxwell_Flanders)\
**Post date:** [December 10, 2016, 4:32pm UTC](https://discuss.elastic.co/t/regex-query-not-working/68503/3 "2016-12-10T16:32:31Z")

</div>

It should still match the lower documents though 😕

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [December 12, 2016, 5:18pm UTC](https://discuss.elastic.co/t/regex-query-not-working/68503/4 "2016-12-12T17:18:37Z")

</div>

Hrm, yeah, I missed the case on the later records. You're right, it should match that. I don't see anything wrong with the regexp in that case.

Believe it or not, the problem may actually be the space between the field name and the regexp.

Try `LOG_MESSAGE:/Event\stype:\s.*\ssize:\s[0-9]{3,}/i`

---

<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:** [January 9, 2017, 5:19pm UTC](https://discuss.elastic.co/t/regex-query-not-working/68503/5 "2017-01-09T17:19:00Z")

</div>

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