<?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 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/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" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/30138iBFE00793C8D550BF/image-size/large?v=v2&amp;amp;px=999" role="button" title="bill_scheuernst_0-1758134463376.png" alt="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" style="width: 576px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/30140i8F9D73D40D7770E9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Auto Tags_Regex_Ex2.png" alt="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>
    <dc:creator>bill_scheuernst</dc:creator>
    <dc:date>2025-09-18T12:49:46Z</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" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/30138iBFE00793C8D550BF/image-size/large?v=v2&amp;amp;px=999" role="button" title="bill_scheuernst_0-1758134463376.png" alt="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" style="width: 576px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/30140i8F9D73D40D7770E9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Auto Tags_Regex_Ex2.png" alt="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>
  </channel>
</rss>

