# Substring and filter an array of values from a data source variable

**URL:** <https://community.grafana.com/t/substring-and-filter-an-array-of-values-from-a-data-source-variable/77481>\
**Category:** Dashboards\
**Created:** [December 6, 2022, 3:00pm UTC](https://community.grafana.com/t/substring-and-filter-an-array-of-values-from-a-data-source-variable/77481 "2022-12-06T15:00:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alencappelletti](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/alencappelletti/32/21348_2.png) [@alencappelletti](https://community.grafana.com/u/alencappelletti)\
**Post date:** [December 6, 2022, 3:00pm UTC](https://community.grafana.com/t/substring-and-filter-an-array-of-values-from-a-data-source-variable/77481/1 "2022-12-06T15:00:22Z")

</div>

Hi all,  
I’m on last version of Grafana 9.3.1 on my docker app in RHES.

I try to substring a variable with a regexp.

My starting values are:

```auto
IADFCODE201\I1
IADFCODE202\I1
IADFCODE203\I1
IADFCODE204\I1
IADFCODE201\KR
IADFDULO201

```

And I would like to get out an array LIKE below.  
For my template page in [regex101: build, test, and debug regex](https://regex101.com/r/qBlKt0/1) the result is correct, but from grafana I got no filter e substring like my idea.

For brevity I put here the regexp that I inseted

`/^[a-zA-Z0-9]+/gm`

This below, is the result that I would like to get.

```auto
IADFCODE201
IADFCODE202
IADFCODE203
IADFCODE204
IADFDULO201

```

Alen
