# Regex search not working on not\_analyzed field

**URL:** <https://discuss.elastic.co/t/regex-search-not-working-on-not-analyzed-field/24603>\
**Category:** Kibana\
**Created:** [June 30, 2015, 7:24am UTC](https://discuss.elastic.co/t/regex-search-not-working-on-not-analyzed-field/24603 "2015-06-30T07:24:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bikrant](https://avatars.discourse-cdn.com/v4/letter/b/f08c70/32.png) [@bikrant](https://discuss.elastic.co/u/bikrant)\
**Post date:** [June 30, 2015, 7:24am UTC](https://discuss.elastic.co/t/regex-search-not-working-on-not-analyzed-field/24603/1 "2015-06-30T07:24:52Z")

</div>

Hi,  
My error log contains lines like:

> exception 'RedisException' with message '127.0.0.1:13635 connection closed'

The log field in not\_analyzed and I'm trying to match the IP and the port using a simple regex but I'm not getting any match.  
The regex filter is

> message:"._'127.0.0.1:[0-9]+ ._"  
> message:"._'127\.0\.0\.1:[0-9]+ ._"

What am I doing wrong here ? I'm using ES 1.6 with Kibana 4.1.1

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 30, 2015, 7:52am UTC](https://discuss.elastic.co/t/regex-search-not-working-on-not-analyzed-field/24603/2 "2015-06-30T07:52:56Z")

</div>

According to the [query string documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_regular_expressions) the regexp must be surrounded by forward slashes. I believe this will work:

message:/.'127.0.0.1:[0-9]+ ./

That said, I think you should use Logstash to parse these strings and extract the information you're interested in to separate fields.

---

<div class="post-metadata">

**Author:** ![bikrant](https://avatars.discourse-cdn.com/v4/letter/b/f08c70/32.png) [@bikrant](https://discuss.elastic.co/u/bikrant)\
**Post date:** [June 30, 2015, 6:39pm UTC](https://discuss.elastic.co/t/regex-search-not-working-on-not-analyzed-field/24603/3 "2015-06-30T18:39:34Z")

</div>

Yes that works. Thank you!

---

<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 6, 2017, 2:17pm UTC](https://discuss.elastic.co/t/regex-search-not-working-on-not-analyzed-field/24603/4 "2017-07-06T14:17:17Z")

</div>


