# Parsing underscore

**URL:** https://discuss.elastic.co/t/parsing-underscore/253104
**Category:** Logstash
**Created:** [October 23, 2020, 9:10am UTC](https://discuss.elastic.co/t/parsing-underscore/253104 "2020-10-23T09:10:19Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rbeg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rbeg/32/56818_2.png) [@rbeg](https://discuss.elastic.co/u/rbeg)
#### Post date: [October 23, 2020, 9:10am UTC](https://discuss.elastic.co/t/parsing-underscore/253104/1 "2020-10-23T09:10:19Z")

</div>

Hello,

Can you help me please?  
I need to parse this field in logstash filter :

word1\_word2\_word3\_word4

And I want to put word3 into a new field named my\_field.

How to do this please?

I try with grok and regular expression.

Thanks

---

<div class="post-metadata">

### Author: ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)
#### Post date: [October 23, 2020, 10:06am UTC](https://discuss.elastic.co/t/parsing-underscore/253104/2 "2020-10-23T10:06:45Z")

</div>

Hello Regis,

Can you post us which grok you have tried? Maybe we can help you with finding the error.

Best regards  
Wolfram

---

<div class="post-metadata">

### Author: ![rbeg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rbeg/32/56818_2.png) [@rbeg](https://discuss.elastic.co/u/rbeg)
#### Post date: [October 23, 2020, 1:58pm UTC](https://discuss.elastic.co/t/parsing-underscore/253104/3 "2020-10-23T13:58:48Z")

</div>

I found a solution with this :

([0-9a-zA-Z]_)(\_)([0-9a-zA-Z]_)(\_)(?\<my\_field\>[0-9a-zA-Z]\*)

---

<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: [November 20, 2020, 1:58pm UTC](https://discuss.elastic.co/t/parsing-underscore/253104/4 "2020-11-20T13:58:55Z")

</div>

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