# Dynatrace Reg exp : Greedy or lazy character classes are not allowed, please use a possessive quantifier instead.

**URL:** <https://community.dynatrace.com/t/dynatrace-reg-exp-greedy-or-lazy-character-classes-are-not-allowed-please-use-a-possessive-quantifier-instead/34093>\
**Category:** Real User Monitoring\
**Tags:** real-user-monitoring-classic\
**Created:** [February 10, 2022, 9:13am UTC](https://community.dynatrace.com/t/dynatrace-reg-exp-greedy-or-lazy-character-classes-are-not-allowed-please-use-a-possessive-quantifier-instead/34093 "2022-02-10T09:13:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ggogi](https://avatars.discourse-cdn.com/v4/letter/g/ecb155/32.png) [@ggogi](https://community.dynatrace.com/u/ggogi)\
**Post date:** [February 10, 2022, 9:13am UTC](https://community.dynatrace.com/t/dynatrace-reg-exp-greedy-or-lazy-character-classes-are-not-allowed-please-use-a-possessive-quantifier-instead/34093/1 "2022-02-10T09:13:07Z")

</div>

Hi All,

In&nbsp;[https://regex101.com/](https://regex101.com/)&nbsp;the expression works but same is not working in dynatrace auto tag configuration rules, getting&nbsp; error as “Greedy or lazy character classes are not allowed, please use a possessive quantifier instead.”

Please help me to fix this, I need to match only 4 hosts Dxxxx201,&nbsp;Dxxxx202,Dxxxx203,&nbsp;Dxxxx204 only in auto tag.

 ![ggogi_1-1644484100299.png](https://global.discourse-cdn.com/dynatrace/original/2X/6/684e1a06b7f728736d85e0bf8cc5158a769f6d16.png)

 ![ggogi_0-1644483960329.png](https://global.discourse-cdn.com/dynatrace/original/3X/f/4/f4fec10c91c2241dc74b03620ecfa43395325797.png)

---

<div class="post-metadata">

**Author:** ![adam\_gardner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/adam_gardner/32/20087_2.png) [@adam\_gardner](https://community.dynatrace.com/u/adam_gardner)\
**Post date:** [February 11, 2022, 4:34am UTC](https://community.dynatrace.com/t/dynatrace-reg-exp-greedy-or-lazy-character-classes-are-not-allowed-please-use-a-possessive-quantifier-instead/34093/2 "2022-02-11T04:34:14Z")

</div>

Perhaps this would work: use two conditions in the same rule. It acts as an AND condition.

“Host name starts with D” AND “host names ends with 201 - 204”

 ![adam_gardner_0-1644553992605.png](https://global.discourse-cdn.com/dynatrace/original/2X/4/4b8a835ec696e63cfae68b653f4450ec08aa5c04.png)

---

<div class="post-metadata">

**Author:** ![ggogi](https://avatars.discourse-cdn.com/v4/letter/g/ecb155/32.png) [@ggogi](https://community.dynatrace.com/u/ggogi)\
**Post date:** [February 11, 2022, 5:17am UTC](https://community.dynatrace.com/t/dynatrace-reg-exp-greedy-or-lazy-character-classes-are-not-allowed-please-use-a-possessive-quantifier-instead/34093/3 "2022-02-11T05:17:25Z")

</div>

Thanks Adam, it worked, it filters only required four hosts.

 ![ggogi_0-1644556582858.png](https://global.discourse-cdn.com/dynatrace/original/3X/0/f/0fb92b3c3e90f47ebf8524b21ab551802ed01aa4.png)
