# Using double quotes in double-quote-escaped regexp query

**URL:** <https://discuss.elastic.co/t/using-double-quotes-in-double-quote-escaped-regexp-query/31564>\
**Category:** Elasticsearch\
**Created:** [October 2, 2015, 8:06pm UTC](https://discuss.elastic.co/t/using-double-quotes-in-double-quote-escaped-regexp-query/31564 "2015-10-02T20:06:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpblair](https://avatars.discourse-cdn.com/v4/letter/j/5e9695/32.png) [@jpblair](https://discuss.elastic.co/u/jpblair)\
**Post date:** [October 2, 2015, 8:06pm UTC](https://discuss.elastic.co/t/using-double-quotes-in-double-quote-escaped-regexp-query/31564/1 "2015-10-02T20:06:18Z")

</div>

I'm trying to do a simple contains regexp query, along the lines of `.*{searchTerm}.*`, and need to escape special characters. I saw this in the Elasticsearch documentation:

> "Additionally, any characters (except double quotes) are interpreted literally when surrounded by double quotes: [john"@smith.com](mailto:john%22@smith.com)"

This works well, except that my search term could also contain double quotes. So how can I escape for everything, including double quotes? Is my only option here to manually do a .replace() for each of the special characters?

---

<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:** [July 5, 2017, 11:46pm UTC](https://discuss.elastic.co/t/using-double-quotes-in-double-quote-escaped-regexp-query/31564/2 "2017-07-05T23:46:59Z")

</div>


