# Regexp - Case Insensitive Not working?

**URL:** https://discuss.elastic.co/t/regexp-case-insensitive-not-working/367259
**Category:** Elasticsearch
**Created:** [September 27, 2024, 5:42pm UTC](https://discuss.elastic.co/t/regexp-case-insensitive-not-working/367259 "2024-09-27T17:42:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![erikg](https://avatars.discourse-cdn.com/v4/letter/e/91b2a8/32.png) [@erikg](https://discuss.elastic.co/u/erikg)
#### Post date: [September 27, 2024, 5:42pm UTC](https://discuss.elastic.co/t/regexp-case-insensitive-not-working/367259/1 "2024-09-27T17:42:26Z")

</div>

Hello,

I am use a regexp query to locate a directory in a 'file.directory'  
When I try to run this: "

```auto
{
  "regexp": {
    "file.directory": {
      "case_insensitive": true,
      "value": "////home.*"
    }
  }
}

```

Expected values:

```auto
> //home/
> //HOME/
> //Home/

```

The issue is no results come back.  
It seems to be related to my regex but also it works once I remove the beginning "////" and place it with ".\*". This returns unwanted values.

Any help?

---

<div class="post-metadata">

### Author: ![Mark\_Harwood1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood1/32/101255_2.png) [@Mark\_Harwood1](https://discuss.elastic.co/u/Mark_Harwood1)
#### Post date: [September 28, 2024, 8:14am UTC](https://discuss.elastic.co/t/regexp-case-insensitive-not-working/367259/2 "2024-09-28T08:14:47Z")

</div>

Hi  
Some possible explanations.

- The forward slash is not in the list of [reserved characters](https://www.elastic.co/guide/en/elasticsearch/reference/current/regexp-syntax.html#regexp-reserved-characters)
- Escaping reserved characters is done with a backslash
- Depending on your mapping the original content may have been tokenised into words and removed the slashes.  
Can you share the mapping?

---

<div class="post-metadata">

### Author: ![erikg](https://avatars.discourse-cdn.com/v4/letter/e/91b2a8/32.png) [@erikg](https://discuss.elastic.co/u/erikg)
#### Post date: [September 30, 2024, 6:28pm UTC](https://discuss.elastic.co/t/regexp-case-insensitive-not-working/367259/3 "2024-09-30T18:28:30Z")

</div>

@Mark_Harwood1 I was using the wrong slashes!

I did also try to use wildcard instead of regexp and it works!

```auto
{
  "wildcard": {
    "file.directory": {
      "case_insensitive": true,
      "value": "\\\\home*"
    }
  }
}

```
