# Regular expression query

**URL:** https://discuss.elastic.co/t/regular-expression-query/308865
**Category:** Kibana
**Created:** [July 5, 2022, 7:28am UTC](https://discuss.elastic.co/t/regular-expression-query/308865 "2022-07-05T07:28:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Krishna\_Sai\_Nag\_G](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krishna_sai_nag_g/32/80467_2.png) [@Krishna\_Sai\_Nag\_G](https://discuss.elastic.co/u/Krishna_Sai_Nag_G)
#### Post date: [July 5, 2022, 7:28am UTC](https://discuss.elastic.co/t/regular-expression-query/308865/1 "2022-07-05T07:28:18Z")

</div>

Hi, i have data as below in my elastic

'My ORDER NO. 013-2009-01 and the order date is March 11, 2009 and delivered date is 13-03-2009 and the product id is B-43.'

I am using regular expression query to get the data from index, i used following query and i am unable to get the data from index due to special characters in order no.

Can anyone help, how to handle special characters in the text in Elasticsearch to retrieve the data.

GET index\_name/\_search  
{  
"\_source": ["file.filename"],  
"query": {  
"regexp": {  
"content": "013-2009-01"  
}  
},  
"highlight": {  
"fields": {  
"content": {}  
}  
}  
}

---

<div class="post-metadata">

### Author: ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)
#### Post date: [July 5, 2022, 1:17pm UTC](https://discuss.elastic.co/t/regular-expression-query/308865/2 "2022-07-05T13:17:05Z")

</div>

Hi @Krishna_Sai_Nag_G. Are you sure you need to use a regular expression query? You don't appear to be using a regular expression in the example.

If you definitely need to use a `regexp` query, you need to set the [correct parameters](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html#regexp-query-field-params) for your field (`content`). You currently have a string where it should be an object.

---

<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: [August 2, 2022, 1:17pm UTC](https://discuss.elastic.co/t/regular-expression-query/308865/3 "2022-08-02T13:17:19Z")

</div>

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