<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[RegEx in DCI]]></title><description><![CDATA[<p dir="auto">Quick one...</p>
<p dir="auto">How would you handle regex in the DCI transformation?</p>
<p dir="auto">Let's say you poll an SNMP OID which returns a string similar to "MyVal=18#-99#AB_01".<br />
You want to extract the "-99" and return an integer to graph it...</p>
<p dir="auto">In Perl it would sth like $1 ~=/#(.+)#/ - if I'm right.</p>
<p dir="auto">Regards,</p>
<p dir="auto">Jdamien</p>
]]></description><link>https://forum.netxms.org/topic/871/regex-in-dci</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 17:49:44 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/871.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 10 Mar 2010 17:24:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to RegEx in DCI on Wed, 10 Mar 2010 17:48:51 GMT]]></title><description><![CDATA[<p dir="auto">Well I'm glad I can answer myself this time <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--wink" style="height:1.4em;width:auto;vertical-align:middle" title=";-)" alt="😉" /></p>
<p dir="auto">Solution is...</p>
<p dir="auto"><strong>sub main()<br />
{<br />
   $1~="#(.*)#";<br />
   return $1;<br />
}</strong></p>
<p dir="auto">This script will return "<strong>-99</strong>" if I give it as input "<strong>MyVal=18#-99#AB_01</strong>".<br />
And for those interested...</p>
<p dir="auto"><strong>sub main()<br />
{<br />
    $1~="#(.*)#(.*)$";<br />
    return $2;<br />
}</strong></p>
<p dir="auto">This one will return "<strong>AB_01</strong>"</p>
<p dir="auto">PS.: "main" not "Main"!!! Otherwise -&gt; Error</p>
<p dir="auto">JDamien</p>
]]></description><link>https://forum.netxms.org/post/4053</link><guid isPermaLink="true">https://forum.netxms.org/post/4053</guid><dc:creator><![CDATA[jdl]]></dc:creator><pubDate>Wed, 10 Mar 2010 17:48:51 GMT</pubDate></item></channel></rss>