# Grok for - \[BT:CHROME, BV:55, BL:en, CC:CZ\]

**URL:** <https://discuss.elastic.co/t/grok-for-bt-chrome-bv-55-bl-en-cc-cz/85962>\
**Category:** Logstash\
**Created:** [May 16, 2017, 3:01pm UTC](https://discuss.elastic.co/t/grok-for-bt-chrome-bv-55-bl-en-cc-cz/85962 "2017-05-16T15:01:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikhilpawar1985](https://avatars.discourse-cdn.com/v4/letter/n/e68b1a/32.png) [@Nikhilpawar1985](https://discuss.elastic.co/u/Nikhilpawar1985)\
**Post date:** [May 16, 2017, 3:01pm UTC](https://discuss.elastic.co/t/grok-for-bt-chrome-bv-55-bl-en-cc-cz/85962/1 "2017-05-16T15:01:33Z")

</div>

Hi , i am trying to capture the while block in the grok along with the square brackets [] . The grok filter field should be displaying the data with the pattern inside it . Can someone please advise what should be grok for this.

[BT:CHROME, BV:55, BL:en, CC:CZ]

---

<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:** [May 18, 2017, 5:28am UTC](https://discuss.elastic.co/t/grok-for-bt-chrome-bv-55-bl-en-cc-cz/85962/2 "2017-05-18T05:28:54Z")

</div>

It's very hard to understand what you're asking. You want to match a string like "[BT:CHROME, BV:55, BL:en, CC:CZ]" and include the square brackets in the resulting field?

---

<div class="post-metadata">

**Author:** ![Nikhilpawar1985](https://avatars.discourse-cdn.com/v4/letter/n/e68b1a/32.png) [@Nikhilpawar1985](https://discuss.elastic.co/u/Nikhilpawar1985)\
**Post date:** [May 18, 2017, 1:09pm UTC](https://discuss.elastic.co/t/grok-for-bt-chrome-bv-55-bl-en-cc-cz/85962/3 "2017-05-18T13:09:50Z")

</div>

Hi @magnusbaeck yes .. i want to match a string like "[BT:CHROME, BV:55, BL:en, CC:CZ]" and include the square brackets in resulting field.

---

<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:** [May 18, 2017, 7:46pm UTC](https://discuss.elastic.co/t/grok-for-bt-chrome-bv-55-bl-en-cc-cz/85962/4 "2017-05-18T19:46:39Z")

</div>

Then perhaps `(?<name-of-field>\[[^\]]*\])` would do. It should match a `[` followed by zero or more characters of any kind except `]`, followed by `]`.

---

<div class="post-metadata">

**Author:** ![Nikhilpawar1985](https://avatars.discourse-cdn.com/v4/letter/n/e68b1a/32.png) [@Nikhilpawar1985](https://discuss.elastic.co/u/Nikhilpawar1985)\
**Post date:** [May 19, 2017, 6:48pm UTC](https://discuss.elastic.co/t/grok-for-bt-chrome-bv-55-bl-en-cc-cz/85962/5 "2017-05-19T18:48:30Z")

</div>

Awesome ..Thanks magnusbaeck. It works

---

<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:** [June 16, 2017, 6:48pm UTC](https://discuss.elastic.co/t/grok-for-bt-chrome-bv-55-bl-en-cc-cz/85962/6 "2017-06-16T18:48:31Z")

</div>

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