# How to extract fields of an array with logstash?

**URL:** <https://discuss.elastic.co/t/how-to-extract-fields-of-an-array-with-logstash/289289>\
**Category:** Logstash\
**Created:** [November 16, 2021, 9:33am UTC](https://discuss.elastic.co/t/how-to-extract-fields-of-an-array-with-logstash/289289 "2021-11-16T09:33:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodri.gz](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@rodri.gz](https://discuss.elastic.co/u/rodri.gz)\
**Post date:** [November 16, 2021, 9:33am UTC](https://discuss.elastic.co/t/how-to-extract-fields-of-an-array-with-logstash/289289/1 "2021-11-16T09:33:00Z")

</div>

hello!

i have a field with this format value:

`["x@correo.es","x@correo.com"]`

and i want to use a scanner tu extract the nested fields with something like this:

```auto
  ruby {
      code => "
         event.set('prueba', event.get('[mail]').scan( (?<=\[")(.*?)(?=\"]) ))
      "
  }

```

Wich regular expression can i use ??

thanks in advanced!!

---

<div class="post-metadata">

**Author:** ![rodri.gz](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@rodri.gz](https://discuss.elastic.co/u/rodri.gz)\
**Post date:** [November 16, 2021, 11:36am UTC](https://discuss.elastic.co/t/how-to-extract-fields-of-an-array-with-logstash/289289/2 "2021-11-16T11:36:18Z")

</div>

i finally solved it.

i use this one:

```auto
  ruby {
      code => "event.set('prueba', event.get('[mail]').scan(/\"(.*?)\"/))"
  }

```

---

<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 14, 2021, 11:36am UTC](https://discuss.elastic.co/t/how-to-extract-fields-of-an-array-with-logstash/289289/3 "2021-12-14T11:36:47Z")

</div>

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