# Creating a custom pattern(regx problem)

**URL:** <https://discuss.elastic.co/t/creating-a-custom-pattern-regx-problem/65245>\
**Category:** Logstash\
**Created:** [November 7, 2016, 4:03pm UTC](https://discuss.elastic.co/t/creating-a-custom-pattern-regx-problem/65245 "2016-11-07T16:03:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![w0lverine](https://avatars.discourse-cdn.com/v4/letter/w/90db22/32.png) [@w0lverine](https://discuss.elastic.co/u/w0lverine)\
**Post date:** [November 7, 2016, 4:03pm UTC](https://discuss.elastic.co/t/creating-a-custom-pattern-regx-problem/65245/1 "2016-11-07T16:03:06Z")

</div>

I am trying to parse a log to only recongize nubmers but the regex, though, it is a valid regex I am still getting a compile error. For example:  
Custom pattern:  
(?([0,1,2,3]) for:

> [Priority: 0]

output:

> Compile ERROR

I am new to regex first of all, but I have searched and searched and have yet come up with a solution of why this simple regx expression is getting a compile error, maybe it has to do with the fact logstash uses oniguruma regex?

---

<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:** [November 8, 2016, 7:58pm UTC](https://discuss.elastic.co/t/creating-a-custom-pattern-regx-problem/65245/2 "2016-11-08T19:58:28Z")

</div>

Your expression appears to open two parentheses but only closes one.

What is `[0,1,2,3]` supposed to mean? I suspect you actually mean `[0123]` or `[0-3]`.

---

<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:** [December 6, 2016, 7:58pm UTC](https://discuss.elastic.co/t/creating-a-custom-pattern-regx-problem/65245/3 "2016-12-06T19:58:59Z")

</div>

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