# How to parse a field which have multiple patterns?

**URL:** <https://discuss.elastic.co/t/how-to-parse-a-field-which-have-multiple-patterns/75586>\
**Category:** Logstash\
**Created:** [February 18, 2017, 10:08am UTC](https://discuss.elastic.co/t/how-to-parse-a-field-which-have-multiple-patterns/75586 "2017-02-18T10:08:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)\
**Post date:** [February 18, 2017, 10:08am UTC](https://discuss.elastic.co/t/how-to-parse-a-field-which-have-multiple-patterns/75586/1 "2017-02-18T10:08:40Z")

</div>

Hi,

I have a field in my log file, which may sometimes has an entry like `'Hello World'` , and if it doesn't has data, it will show just `-` sign. I gave defined it as `'%{GREEDYDATA:helloworld}'` , which gives me grokparsefailure when data is `-`. I cant remove `' '` here, since I don't want that single quote in my entry, that single quote is meant to distinguish the log entries having white-space. So my question is, How can I parse the data with `' '` and `-` at the same time?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)\
**Post date:** [February 18, 2017, 10:17am UTC](https://discuss.elastic.co/t/how-to-parse-a-field-which-have-multiple-patterns/75586/2 "2017-02-18T10:17:41Z")

</div>

tried `(('%{GREEDYDATA:helloworld}')|(%{GREEDYDATA:helloworld}))` , but not working

---

<div class="post-metadata">

**Author:** ![elasticheart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticheart/32/65189_2.png) [@elasticheart](https://discuss.elastic.co/u/elasticheart)\
**Post date:** [February 18, 2017, 11:16am UTC](https://discuss.elastic.co/t/how-to-parse-a-field-which-have-multiple-patterns/75586/3 "2017-02-18T11:16:02Z")

</div>

Solved by using `('%{GREEDYDATA:helloworld}'|%{GREEDYDATA:helloworld})`

---

<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:** [March 18, 2017, 11:16am UTC](https://discuss.elastic.co/t/how-to-parse-a-field-which-have-multiple-patterns/75586/4 "2017-03-18T11:16:03Z")

</div>

Closed on March 18, 2017, 11:16am UTC

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