# Reg ex not working for templates

**URL:** <https://discuss.elastic.co/t/reg-ex-not-working-for-templates/137283>\
**Category:** Elasticsearch\
**Created:** [June 25, 2018, 3:15pm UTC](https://discuss.elastic.co/t/reg-ex-not-working-for-templates/137283 "2018-06-25T15:15:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yogesh\_BG](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yogesh_bg/32/70018_2.png) [@Yogesh\_BG](https://discuss.elastic.co/u/Yogesh_BG)\
**Post date:** [June 25, 2018, 3:15pm UTC](https://discuss.elastic.co/t/reg-ex-not-working-for-templates/137283/1 "2018-06-25T15:15:05Z")

</div>

Hi

I have a scenario where there are three types of indices are formed

1. 12sfds-1312b-hjhbj-hbj22-2018.08.30-logs
2. 12sfds-1312b-hjhbj-hbj22-2018.08.30-10
3. 12sfds-1312b-hjhbj-hbj22-2018.08.30

I have certain set of index templates to be executed on index type 1 and certain set of templates on index type 2 and 3

But the issue am facing is for type 1 i can specify template as reg ex \*-logs

but for 2nd and 3rd type i have to say any index which doesn't end with logs for which i have used below reg exp and it doesn't work

^((?!logs).)\*$

log says ? and \* is not allowed. Any help on configuring this reg exp?

I am using elastic search 2.4

---

<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 23, 2018, 3:24pm UTC](https://discuss.elastic.co/t/reg-ex-not-working-for-templates/137283/2 "2018-07-23T15:24:12Z")

</div>

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