# Regexp and case insensitive

**URL:** <https://discuss.elastic.co/t/regexp-and-case-insensitive/1288>\
**Category:** Elasticsearch\
**Created:** [May 26, 2015, 8:15am UTC](https://discuss.elastic.co/t/regexp-and-case-insensitive/1288 "2015-05-26T08:15:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rore/32/399_2.png) [@rore](https://discuss.elastic.co/u/rore)\
**Post date:** [May 26, 2015, 8:15am UTC](https://discuss.elastic.co/t/regexp-and-case-insensitive/1288/1 "2015-05-26T08:15:46Z")

</div>

As far as I know there is no option to provide a case insensitive option for regexp query or filter.

Is there a good reason for that?

This means that in order to provide case insensitive regex searches you need to have a multi field, once with the original term and once lower cased.

This is quite an overhead when having a lot of documents or fields. If the lower case regex search is something that doesn't happen often, it can be better to "pay" the runtime CPU overhead rather than always sustain the indexing overhead of keeping multiple indexes of the field.

---

<div class="post-metadata">

**Author:** ![adi](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@adi](https://discuss.elastic.co/u/adi)\
**Post date:** [November 17, 2015, 11:23am UTC](https://discuss.elastic.co/t/regexp-and-case-insensitive/1288/2 "2015-11-17T11:23:51Z")

</div>

Hi Rotem,

Did you find any solution which is not multi-field or something like [Bb][Ll][Aa][Bb][Ll][Aa]?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [November 17, 2015, 1:24pm UTC](https://discuss.elastic.co/t/regexp-and-case-insensitive/1288/3 "2015-11-17T13:24:30Z")

</div>

The trouble is that Lucene regexes don't have the option to support case insensitive searching. I'd cobbled together something _mostly_ works in [wikimedia-extra](https://github.com/wikimedia/search-extra)'s `source_regex` filter. Its by no means perfect or efficient at all or even right in some cases. And it doesn't work like the regular regex search either so its not a standin for what you are doing. So I can't really suggest that you use it, its more like a case study in why its hard.

---

<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:37pm UTC](https://discuss.elastic.co/t/regexp-and-case-insensitive/1288/4 "2017-07-05T23:37:57Z")

</div>


