<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Regular Expressions and Auto Tags in Open Q&amp;A</title>
    <link>https://community.dynatrace.com/t5/Open-Q-A/Regular-Expressions-and-Auto-Tags/m-p/303666#M40143</link>
    <description>&lt;P&gt;Hey Bill, Sorry this is a late reply, but Dynatrace Regex can be finicky, You could call out the design of the naming convention and then parse out the segment that you want. I use Regex101 to test things out as well as trial it all out in Dynatrace.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Try this: ([A-Z]{3})[A-Z0-9]{7}\.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChadTurner_1-1787319797914.png"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/34108i2C9DFF88FC1C3FB3/image-size/medium?v=v2&amp;amp;px=400" alt="ChadTurner_1-1787319797914.png" title="ChadTurner_1-1787319797914.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming that your host names will always be 10 Characters.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Aug 2026 13:43:58 GMT</pubDate>
    <dc:creator>ChadTurner</dc:creator>
    <dc:date>2026-08-21T13:43:58Z</dc:date>
    <item>
      <title>Regular Expressions and Auto Tags</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Regular-Expressions-and-Auto-Tags/m-p/286316#M37605</link>
      <description>&lt;P&gt;I am working on an Auto Tag rule for custom devices using a regular expression statement which for the most part is successful.&amp;nbsp; I am seeing though where the tag key gets duplicated, with either no value, or a value which was to be excluded from the result.&lt;/P&gt;&lt;P&gt;Example #1 -&amp;nbsp;&lt;/P&gt;&lt;P&gt;{CustomDevice:Name/^([A-Za-z][A-Za-z][A-Za-z])}&lt;/P&gt;&lt;P&gt;Using &lt;STRONG&gt;CMHLEAF123.test.com&lt;/STRONG&gt; as the entity name, the results are -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bill_scheuernst_0-1758134463376.png"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/30138iBFE00793C8D550BF/image-size/large?v=v2&amp;amp;px=999" alt="bill_scheuernst_0-1758134463376.png" title="bill_scheuernst_0-1758134463376.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The rule correctly captures the three letter code used for the tag key, as seen in the "Site Code:CMH" tag, however I'm not exactly sure how the tag, "Site Code", with no value assigned, is applied.&amp;nbsp; I have no rule which suggests this.&lt;/P&gt;&lt;P&gt;Example #2 -&amp;nbsp;&lt;/P&gt;&lt;P&gt;{CustomDevice:Name/(?:Cisco network device) ([A-Za-z][A-Za-z][A-Za-z])}&lt;/P&gt;&lt;P&gt;Using&amp;nbsp;&lt;STRONG&gt;Cisco network device CMHLEAF123.test.com&lt;/STRONG&gt; as the entity name, the results are -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Auto Tags_Regex_Ex2.png"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/30140i8F9D73D40D7770E9/image-size/large?v=v2&amp;amp;px=999" alt="Auto Tags_Regex_Ex2.png" title="Auto Tags_Regex_Ex2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In this example, the rule correctly captures the three letter code used for the tag value, as seen in the "Site Code:CMH" tag, however I'm not exactly sure how the tag, "Site Code:CIS" is created especially since I've specifically excluded the additional text in the regular expression statement.&lt;/P&gt;&lt;P&gt;The first example occurs not just for the Site Code tag, but for other tags as well, as seen with the "Host group" tag.&lt;/P&gt;&lt;P&gt;I am looking for suggestions from the community on this.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Is there a better way of doing this using RegEx?&lt;/LI&gt;&lt;LI&gt;Is there a better way to exclude all of the text at the beginning, and still capture the three letters of a host name?&lt;/LI&gt;&lt;LI&gt;What causes the duplicate tag key, either with no value or one which is explicitly excluded?&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Thu, 18 Sep 2025 12:49:46 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Regular-Expressions-and-Auto-Tags/m-p/286316#M37605</guid>
      <dc:creator>bill_scheuernst</dc:creator>
      <dc:date>2025-09-18T12:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Regular Expressions and Auto Tags</title>
      <link>https://community.dynatrace.com/t5/Open-Q-A/Regular-Expressions-and-Auto-Tags/m-p/303666#M40143</link>
      <description>&lt;P&gt;Hey Bill, Sorry this is a late reply, but Dynatrace Regex can be finicky, You could call out the design of the naming convention and then parse out the segment that you want. I use Regex101 to test things out as well as trial it all out in Dynatrace.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Try this: ([A-Z]{3})[A-Z0-9]{7}\.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChadTurner_1-1787319797914.png"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/34108i2C9DFF88FC1C3FB3/image-size/medium?v=v2&amp;amp;px=400" alt="ChadTurner_1-1787319797914.png" title="ChadTurner_1-1787319797914.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming that your host names will always be 10 Characters.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2026 13:43:58 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Open-Q-A/Regular-Expressions-and-Auto-Tags/m-p/303666#M40143</guid>
      <dc:creator>ChadTurner</dc:creator>
      <dc:date>2026-08-21T13:43:58Z</dc:date>
    </item>
  </channel>
</rss>

