# Regex pattern to search in kibana

**URL:** <https://discuss.elastic.co/t/regex-pattern-to-search-in-kibana/227089>\
**Category:** Kibana\
**Created:** [April 8, 2020, 9:24am UTC](https://discuss.elastic.co/t/regex-pattern-to-search-in-kibana/227089 "2020-04-08T09:24:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)\
**Post date:** [April 8, 2020, 9:24am UTC](https://discuss.elastic.co/t/regex-pattern-to-search-in-kibana/227089/1 "2020-04-08T09:24:43Z")

</div>

```
HI,
I want to search using regex pattern in kibana. i have message and i want to search specific keyword and how could i achieve it.

i tried below and its gets match everything

message:.*User_id/[0-9]+/
```

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [April 8, 2020, 12:59pm UTC](https://discuss.elastic.co/t/regex-pattern-to-search-in-kibana/227089/2 "2020-04-08T12:59:33Z")

</div>

To use regex, you have to switch from KQL to Lucene as your query language first.

Then, the regex has to be wrapped by slashes (and slashes within the query have to be escaped: `message:/.*User_id\/[0-9]+\//`

---

<div class="post-metadata">

**Author:** ![Ganesh2303](https://avatars.discourse-cdn.com/v4/letter/g/57b2e6/32.png) [@Ganesh2303](https://discuss.elastic.co/u/Ganesh2303)\
**Post date:** [April 8, 2020, 2:43pm UTC](https://discuss.elastic.co/t/regex-pattern-to-search-in-kibana/227089/3 "2020-04-08T14:43:00Z")

</div>

Can you help me on script section to create scripted field in kibana,

2020-04-08 12:18:13:153 log - Received JSON Response: UserID: 123456

need to extract userid value from above message and above message is stored in message field.

---

<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:** [May 6, 2020, 2:43pm UTC](https://discuss.elastic.co/t/regex-pattern-to-search-in-kibana/227089/4 "2020-05-06T14:43:03Z")

</div>

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