# Pro Tip - Using Regex for Dynamic Tagging

**URL:** <https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958>\
**Category:** Dynatrace Tips\
**Tags:** regex, management-zones, tagging\
**Created:** [June 29, 2021, 6:08pm UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958 "2021-06-29T18:08:31Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [June 29, 2021, 6:08pm UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/1 "2021-06-29T18:08:31Z")

</div>

Depending on the size of your environment, odds are you are using automatic tagging. Automatic tagging is great but also can have its downfalls. Over the last several updates, Dynatrace has increased the functionality of its tagging.

- Tagging Entity Names

With larger organizations adopting new technologies and methodologies, its important to provide tags on these entities. For example. Lets say we have our Application “EasyTravel” but your organization is shifting from being hosted on VMWare to AWS. As a result, you have two different EasyTravel Apps now “AWS EasyTravel” and “VM EasyTravel” you can use custom regex to pull the dynamic values of the Application Names. I like to use [www.regex101.com](http://www.regex101.com)&nbsp;to test all my regex:

 ![ChadTurner_0-1624989387393.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/2/a2a0dfd678f41180bfd3e00135acd3dfdc10a3c7.png)

Then we just supply that in: by adding the /\<RegexCode\>}

 ![ChadTurner_1-1624989555652.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/2/a2fa5dd0174b523924bfa4c18a15b7d22eff88f0.png)

Once you create and save this rule, it will apply to the entire scope. You can also use this for Environment as well by just updating your Regex:

 ![ChadTurner_2-1624989801886.png](https://global.discourse-cdn.com/dynatrace/original/3X/e/d/ed6d19de001c549c58eececd08cf4f32ca29e18f.png)

Using dynamic regex tagging allows you to create one rule that will provide the targeted value of a set entities across the entire scope! So no more single rules stating if the name contains NP1, tag it with NP1 and so on.

The possibilities are endless and can be used for Hosts, Processes, Services, Applications, Synthetics, Properties and so much more!

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [June 29, 2021, 6:16pm UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/2 "2021-06-29T18:16:06Z")

</div>

Important Note: Naming standards do come in handy as it will ensure the data you are looking for is in the same location each and every time, thus allowing your Regex to work 100%

---

<div class="post-metadata">

**Author:** ![larry\_roberts](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/larry_roberts/32/7131_2.png) [@larry\_roberts](https://community.dynatrace.com/u/larry_roberts)\
**Post date:** [June 29, 2021, 7:59pm UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/3 "2021-06-29T19:59:46Z")

</div>

Great stuff Chad!&nbsp;👍

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [June 29, 2021, 8:01pm UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/4 "2021-06-29T20:01:18Z")

</div>

Thanks&nbsp;[@larry\_roberts](https://community.dynatrace.com/user/33677)&nbsp;:dynaspin:

---

<div class="post-metadata">

**Author:** ![kboadi](https://avatars.discourse-cdn.com/v4/letter/k/c2a13f/32.png) [@kboadi](https://community.dynatrace.com/u/kboadi)\
**Post date:** [July 7, 2021, 2:56pm UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/5 "2021-07-07T14:56:05Z")

</div>

Good stuff Chad

---

<div class="post-metadata">

**Author:** ![VVormawor](https://avatars.discourse-cdn.com/v4/letter/v/b4bc9f/32.png) [@VVormawor](https://community.dynatrace.com/u/VVormawor)\
**Post date:** [July 7, 2021, 6:05pm UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/6 "2021-07-07T18:05:38Z")

</div>

Hi Chad, I have to admit that you are an iconic person on our Team for keeping us abreast with Dynatrace, assisting and answering our questions as always! Thank you and it’s very much appreciated!

---

<div class="post-metadata">

**Author:** ![VVormawor](https://avatars.discourse-cdn.com/v4/letter/v/b4bc9f/32.png) [@VVormawor](https://community.dynatrace.com/u/VVormawor)\
**Post date:** [July 7, 2021, 6:07pm UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/7 "2021-07-07T18:07:08Z")

</div>

You are awesome, Chad!

---

<div class="post-metadata">

**Author:** ![ct\_27](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ct_27/32/10499_2.png) [@ct\_27](https://community.dynatrace.com/u/ct_27)\
**Post date:** [July 12, 2021, 6:34pm UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/8 "2021-07-12T18:34:50Z")

</div>

great writeup.&nbsp; This has me thinking about some of our existing configuration.&nbsp; Might be time for improvement.

---

<div class="post-metadata">

**Author:** ![Fin\_Ubels](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/fin_ubels/32/18008_2.png) [@Fin\_Ubels](https://community.dynatrace.com/u/Fin_Ubels)\
**Post date:** [July 8, 2022, 6:38am UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/9 "2022-07-08T06:38:22Z")

</div>

This is a fantastic tip, I have been using/suggesting this for a while now and I came here to post about it on the community as a tip but found you had already beaten me to it by a whole year!&nbsp;😁

I have also found it to be really helpful for tagging based on the host groups if you can decide on a naming scheme for host groups. You can then propagate environments, locations and other tags throughout your environment making it easier to navigate!

---

<div class="post-metadata">

**Author:** ![GustavoPires](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GustavoPires](https://community.dynatrace.com/u/GustavoPires)\
**Post date:** [August 5, 2023, 9:11pm UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/10 "2023-08-05T21:11:46Z")

</div>

Hey Chad,

Where can I find this screen to apply the regex and can I use the same regex to different process group?

To be more directly, with an Automatically Tag I can’t set to apply the same “rule tag” to services but from different processes, even if I create different condition. Because today isn’t an option to use the “or” operator… so since it always use “and”, i can only set one process group by rule. So my idea is to add the same regex for those process groups and use a single condition with this regex as value to apply to all services with the same rule.

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [August 7, 2023, 11:34am UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/11 "2023-08-07T11:34:22Z")

</div>

You can see all the Dynamic tag values from the following segment of the Auto Tag page:

 ![ChadTurner_0-1691407727457.png](https://global.discourse-cdn.com/dynatrace/original/3X/d/2/d2ec6ceb5d223993315d3a46317e505a47325d7e.png)

Granted the ‘code’ for process groups will not apply to services, unless you leverage one of the tag options to apply to underlying services/hosts:

 ![ChadTurner_1-1691408027188.png](https://global.discourse-cdn.com/dynatrace/original/2X/8/82da626b2e4a46a83a60aed7c6508bab519aade5.png)

---

<div class="post-metadata">

**Author:** ![GustavoPires](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GustavoPires](https://community.dynatrace.com/u/GustavoPires)\
**Post date:** [August 7, 2023, 1:01pm UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/12 "2023-08-07T13:01:28Z")

</div>

After some learning about regex I understood how to use it…

Basically I could apply a tag value in services running on different process group using “contains regex”, it allows me to add multiple regex separating by pipes “|”, it worked as an “or” operator in the same rule.

It saved me a lot of time.

Thank you Chad, your tip helped me a lot. It brought me to the solution!

---

<div class="post-metadata">

**Author:** ![mikemugge](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@mikemugge](https://community.dynatrace.com/u/mikemugge)\
**Post date:** [August 11, 2025, 2:39pm UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/13 "2025-08-11T14:39:46Z")

</div>

I can’t get this working when the Rule Type is “Entity Selector” because it takes away the “Add condition” button. This is a major drag.&nbsp; Can you get that fixed?

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [August 11, 2025, 3:02pm UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/14 "2025-08-11T15:02:34Z")

</div>

[@mikemugge](https://community.dynatrace.com/user/94341)&nbsp;If the rule type is entity selector, then you need to put a condition in the selector. Add conditions button is displayed only if you are tagging the core entities and not using entity selector.

---

<div class="post-metadata">

**Author:** ![mikemugge](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@mikemugge](https://community.dynatrace.com/u/mikemugge)\
**Post date:** [August 11, 2025, 9:04pm UTC](https://community.dynatrace.com/t/pro-tip-using-regex-for-dynamic-tagging/31958/15 "2025-08-11T21:04:09Z")

</div>

My selector works just fine. I got it working another way. It would be very useful to have official documentation though since it seems there is still some unexplained nuance.
