# Curator "regular expression matching with timestrings"

**URL:** <https://discuss.elastic.co/t/curator-regular-expression-matching-with-timestrings/240401>\
**Category:** Elasticsearch\
**Tags:** curator\
**Created:** [July 8, 2020, 4:20pm UTC](https://discuss.elastic.co/t/curator-regular-expression-matching-with-timestrings/240401 "2020-07-08T16:20:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsk0](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rsk0/32/124810_2.png) [@rsk0](https://discuss.elastic.co/u/rsk0)\
**Post date:** [July 8, 2020, 4:20pm UTC](https://discuss.elastic.co/t/curator-regular-expression-matching-with-timestrings/240401/1 "2020-07-08T16:20:52Z")

</div>

Curator [docs](https://www.elastic.co/guide/en/elasticsearch/client/curator/current/filtertype_age.html) say

> What this means is that a simple timestring to match year and month, `%Y.%m` will result in a regular expression like this: `^.*\d{4}\.\d{2}.*$` . This pattern will match any 4 digits, followed by a period `.` , followed by 2 digits, occurring anywhere in the index name.

It seems to me that a pattern like `^foo$` shouldn't match `foo` _anywhere_ in an index name. Hopefully regex anchors actually work (against the whole index name string)? I assume one of those two sentences is wrong.

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [July 8, 2020, 4:41pm UTC](https://discuss.elastic.co/t/curator-regular-expression-matching-with-timestrings/240401/2 "2020-07-08T16:41:58Z")

</div>

You’re missing that there are two `.*` immediately after the `^` and immediately before the `$` anchors, meaning that the date string can occur anywhere inside the index name.

---

<div class="post-metadata">

**Author:** ![rsk0](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rsk0/32/124810_2.png) [@rsk0](https://discuss.elastic.co/u/rsk0)\
**Post date:** [July 8, 2020, 8:05pm UTC](https://discuss.elastic.co/t/curator-regular-expression-matching-with-timestrings/240401/3 "2020-07-08T20:05:15Z")

</div>

My bad. Just wasn't looking very closely. Thanks!

---

<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 5, 2020, 8:05pm UTC](https://discuss.elastic.co/t/curator-regular-expression-matching-with-timestrings/240401/4 "2020-08-05T20:05:18Z")

</div>

Closed on August 5, 2020, 8:05pm UTC

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