# Grok - Positive Lookbehind

**URL:** <https://discuss.elastic.co/t/grok-positive-lookbehind/103005>\
**Category:** Logstash\
**Created:** [October 6, 2017, 12:32pm UTC](https://discuss.elastic.co/t/grok-positive-lookbehind/103005 "2017-10-06T12:32:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paolo1](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@paolo1](https://discuss.elastic.co/u/paolo1)\
**Post date:** [October 6, 2017, 12:32pm UTC](https://discuss.elastic.co/t/grok-positive-lookbehind/103005/1 "2017-10-06T12:32:41Z")

</div>

Hi,

Does grok match support 'positive lookbehind'? I'm take everything after 'Details=' in the following json example:

{  
"Field":"Details=xyz"  
}

match =\> ["Field", "(?\< Field2 \>(?\<=Details=).\*)"]

I am getting grok failures even though the construction in the match is sound..

---

<div class="post-metadata">

**Author:** ![paz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paz/32/28003_2.png) [@paz](https://discuss.elastic.co/u/paz)\
**Post date:** [October 9, 2017, 1:21pm UTC](https://discuss.elastic.co/t/grok-positive-lookbehind/103005/2 "2017-10-09T13:21:49Z")

</div>

Grok does indeed support lookaheads/lookbehinds as regex expression. The reason you're probably getting grokfailures is those spaces inside the capture group name. Try this instead

```auto
grok {
    match => {
        "Field" => "(?<Field2>(?<=Details=).*)"
    }
}
```

---

<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 6, 2017, 1:21pm UTC](https://discuss.elastic.co/t/grok-positive-lookbehind/103005/3 "2017-11-06T13:21:56Z")

</div>

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