# Grok pattern with special character (2)

**URL:** <https://discuss.elastic.co/t/grok-pattern-with-special-character-2/221846>\
**Category:** Elasticsearch\
**Created:** [March 3, 2020, 9:43am UTC](https://discuss.elastic.co/t/grok-pattern-with-special-character-2/221846 "2020-03-03T09:43:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cuju](https://avatars.discourse-cdn.com/v4/letter/c/ecc23a/32.png) [@Cuju](https://discuss.elastic.co/u/Cuju)\
**Post date:** [March 3, 2020, 9:43am UTC](https://discuss.elastic.co/t/grok-pattern-with-special-character-2/221846/1 "2020-03-03T09:43:20Z")

</div>

Hello,

I recreate the post because I think I have done something wrong with the first one.

It's actually a question but I didn't manage to get the answer : I would like to create a grok but in the field I parse, sometimes it has the `:` character, and instead of doing multiple grok patterns, is it possible to make the `:` into a possibility but not as always present ?

I hope it is understandable and thanks.

---

<div class="post-metadata">

**Author:** ![Cuju](https://avatars.discourse-cdn.com/v4/letter/c/ecc23a/32.png) [@Cuju](https://discuss.elastic.co/u/Cuju)\
**Post date:** [March 3, 2020, 10:54am UTC](https://discuss.elastic.co/t/grok-pattern-with-special-character-2/221846/2 "2020-03-03T10:54:03Z")

</div>

I think I found it : `(?:%{:})?`

Can I have the confirmation, please ?

---

<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 31, 2020, 10:54am UTC](https://discuss.elastic.co/t/grok-pattern-with-special-character-2/221846/3 "2020-03-31T10:54:04Z")

</div>

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