<?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 Using a wildcard in DPL and matchesPattern() in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Using-a-wildcard-in-DPL-and-matchesPattern/m-p/277871#M2130</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've been diving into DPL and the matchesPattern() function to get around the lack of regex in filtering DQL results, so far all is well but I'm running into an issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Say for example, I'm filtering a set of hosts from a fetch dt.entity.host DQL query and I want to filter down specific hosts. I understand the way to create a DPL pattern that filters down some of those hosts, in the same vein as Regex.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only roadblock I seem to not be able to get around is understanding how wildcards are implemented in DPL, if any. If I have multiple hosts names like this:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;"ABCDE-1234"&lt;/LI&gt;
&lt;LI&gt;"ABXYZ-3492"&lt;/LI&gt;
&lt;LI&gt;"ABLOL-1000.some.name"&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;My original thought was creating a matchesPattern() along the line of -&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;matchesPattern(entity.name, "'AB' LD{3} '-' DIGIT{4}")&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;This would capture the first two host names listed above but to capture all three, I would of course use a wildcard to optionally include anything after the four digits of the name. However, unless I'm missing something while reading through the documentation for DPL, I don't see a case for using a wildcard.&amp;nbsp;Something that would allow me to match any cases where the pattern is explicitly matched *and* is contained in a larger string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I may be going about this wrong but in a use case where I want to filter based off of a specific pattern (explicitly or included in a larger string), would DPL still be the correct way? Or should I be using something like contains()?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 23 May 2025 07:49:26 GMT</pubDate>
    <dc:creator>Irvin_naylor01</dc:creator>
    <dc:date>2025-05-23T07:49:26Z</dc:date>
    <item>
      <title>Using a wildcard in DPL and matchesPattern()</title>
      <link>https://community.dynatrace.com/t5/DQL/Using-a-wildcard-in-DPL-and-matchesPattern/m-p/277871#M2130</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've been diving into DPL and the matchesPattern() function to get around the lack of regex in filtering DQL results, so far all is well but I'm running into an issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Say for example, I'm filtering a set of hosts from a fetch dt.entity.host DQL query and I want to filter down specific hosts. I understand the way to create a DPL pattern that filters down some of those hosts, in the same vein as Regex.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only roadblock I seem to not be able to get around is understanding how wildcards are implemented in DPL, if any. If I have multiple hosts names like this:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;"ABCDE-1234"&lt;/LI&gt;
&lt;LI&gt;"ABXYZ-3492"&lt;/LI&gt;
&lt;LI&gt;"ABLOL-1000.some.name"&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;My original thought was creating a matchesPattern() along the line of -&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;matchesPattern(entity.name, "'AB' LD{3} '-' DIGIT{4}")&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;This would capture the first two host names listed above but to capture all three, I would of course use a wildcard to optionally include anything after the four digits of the name. However, unless I'm missing something while reading through the documentation for DPL, I don't see a case for using a wildcard.&amp;nbsp;Something that would allow me to match any cases where the pattern is explicitly matched *and* is contained in a larger string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I may be going about this wrong but in a use case where I want to filter based off of a specific pattern (explicitly or included in a larger string), would DPL still be the correct way? Or should I be using something like contains()?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 May 2025 07:49:26 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Using-a-wildcard-in-DPL-and-matchesPattern/m-p/277871#M2130</guid>
      <dc:creator>Irvin_naylor01</dc:creator>
      <dc:date>2025-05-23T07:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Using a wildcard in DPL and matchesPattern()</title>
      <link>https://community.dynatrace.com/t5/DQL/Using-a-wildcard-in-DPL-and-matchesPattern/m-p/277873#M2131</link>
      <description>&lt;DIV&gt;Hello.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm not sure if there is a correct way, but there are probably many ways to achieve what you are trying to do.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;For the DPL pattern including the "LD?" will match anything (optionaly), adding it at the end will capture all the 3 examples, you can also add it on the start if necessary.&lt;/DIV&gt;&lt;LI-CODE lang="markup"&gt;filter matchesPattern(name, "LD? 'AB' LD{3} '-' DIGIT{4} LD?")&lt;/LI-CODE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Other possible solutions I could think of:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;1. You can still use managementZones even though somewhat limited&lt;/DIV&gt;&lt;LI-CODE lang="markup"&gt;fetch dt.entity.host
| filter in(managementZones, "my_mz")&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;timeseries avg(dt.host.cpu.idle), filter: in(dt.entity.host, classicEntitySelector("type(HOST),mzName(my_mz)"))&lt;/LI-CODE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;2. If you are using this for the new dashboards you could also create a hidden variable with a predefined list of hosts name/ids, set it to select all by default and use it to filter for the ones you want.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Let me know if you need more help!&lt;BR /&gt;Best Regards,&lt;/DIV&gt;&lt;DIV&gt;Rafael Fernandes&lt;/DIV&gt;</description>
      <pubDate>Thu, 22 May 2025 21:42:23 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Using-a-wildcard-in-DPL-and-matchesPattern/m-p/277873#M2131</guid>
      <dc:creator>RafaelF</dc:creator>
      <dc:date>2025-05-22T21:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using a wildcard in DPL and matchesPattern()</title>
      <link>https://community.dynatrace.com/t5/DQL/Using-a-wildcard-in-DPL-and-matchesPattern/m-p/277934#M2132</link>
      <description>&lt;P&gt;Thanks for the reply, Rafael&lt;/P&gt;&lt;P&gt;The first solution with LD? worked perfectly, don't know how I missed that.&amp;nbsp;The other solutions were also valuable- will keep those two in mind if this ever becomes a larger scope!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Fri, 23 May 2025 16:33:55 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Using-a-wildcard-in-DPL-and-matchesPattern/m-p/277934#M2132</guid>
      <dc:creator>Irvin_naylor01</dc:creator>
      <dc:date>2025-05-23T16:33:55Z</dc:date>
    </item>
  </channel>
</rss>

