# Search: Removing full stop if part of acronym / abbreviation with pattern\_replace character filter

**URL:** <https://discuss.elastic.co/t/search-removing-full-stop-if-part-of-acronym-abbreviation-with-pattern-replace-character-filter/329810>\
**Category:** Elasticsearch\
**Created:** [April 12, 2023, 8:24am UTC](https://discuss.elastic.co/t/search-removing-full-stop-if-part-of-acronym-abbreviation-with-pattern-replace-character-filter/329810 "2023-04-12T08:24:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marzipan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marzipan/32/119722_2.png) [@Marzipan](https://discuss.elastic.co/u/Marzipan)\
**Post date:** [April 12, 2023, 8:24am UTC](https://discuss.elastic.co/t/search-removing-full-stop-if-part-of-acronym-abbreviation-with-pattern-replace-character-filter/329810/1 "2023-04-12T08:24:05Z")

</div>

Hi!  
My input are author names and book titles.  
I try to delete full stops if they appear in acronyms and abbreviations.  
For example:  
S.O.S. should be replaced with SOS  
H.P. Lovecraft should be replaced with HP Lovecraft  
My current regex replaces everything, I have not yet found a way to only match the full stops.

My current analyzers and filters:

```auto
"analysis": {
      "filter": {
        "autocomplete_filter": {
          "type": "edge_ngram",
          "min_gram": 1,
          "max_gram": 20
        }
      },
      "char_filter": {
        "remove_fullstop": {
          "type": "pattern_replace",
          "pattern": """\w+(?:\.\w+)+""",
          "replacement": ""
        }
      },
      "analyzer": {
        "standard_ascii": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "asciifolding"
          ],
          "char_filter": [
            "remove_fullstop"
          ]
        },
        "autocomplete": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "asciifolding",
            "autocomplete_filter"
          ],
          "char_filter": [
            "remove_fullstop"
          ]
        }
      }
    }

```

Does anyone know a solution?  
Thank you in advance!

---

<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:** [May 10, 2023, 8:24am UTC](https://discuss.elastic.co/t/search-removing-full-stop-if-part-of-acronym-abbreviation-with-pattern-replace-character-filter/329810/2 "2023-05-10T08:24:17Z")

</div>

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