# Regex for Elastic Search within Graph panel not working (Lucene Query)

**URL:** <https://community.grafana.com/t/regex-for-elastic-search-within-graph-panel-not-working-lucene-query/28965>\
**Category:** Grafana\
**Created:** [April 21, 2020, 7:59am UTC](https://community.grafana.com/t/regex-for-elastic-search-within-graph-panel-not-working-lucene-query/28965 "2020-04-21T07:59:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cjpsam1973](https://avatars.discourse-cdn.com/v4/letter/c/258eb7/32.png) [@cjpsam1973](https://community.grafana.com/u/cjpsam1973)\
**Post date:** [April 21, 2020, 7:59am UTC](https://community.grafana.com/t/regex-for-elastic-search-within-graph-panel-not-working-lucene-query/28965/1 "2020-04-21T07:59:14Z")

</div>

Hello Team,

I have started using Elastic Search recently and trying to build dashboard based on Elastic Search data sets.

I’m trying to use **regex** to get the **Jira Key** from one of field within Elastic Search.  
I could see it works both in the **[regex101.com](http://regex101.com) site** and also when I define a **template Variable** and apply the regex to the field ( ((?=([A-Z]{1,10})-?)[A-Z]±\d+) ), I could see the searched values displayed (refer attached screen shot).

 ![Screen Shot 2020-04-21 at 1.13.21 PM](https://us1.discourse-cdn.com/grafana/original/2X/0/049c5d513432e96ddc9b5b398db6c882a4d4f543.png)

The problem I have is that, when I tried to apply the same regex within a graph panel within the query section, **I’m not getting the search work here**. Tried escaping the unicode characters in the expression as well ( field:/.\*((?=([A-Z]{1,10})-?)[A-Z]+-\d+).\*/g ) but still not working,

![Screen Shot 2020-04-21 at 1.16.37 PM](https://us1.discourse-cdn.com/grafana/original/2X/9/988ef6f63f7f449c721da006787cc86830922b2f.png)

Could you please let me whether the regex within a template variable works differently from within a query section of graph panel (Since the data is large within a variable (more than 1024), I need to apply the regex within graph panel to get the count of matching patterns

Thanks  
Sam
