<?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: Why is my rex command not extracting the field from my data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146734#M40991</link>
    <description>&lt;P&gt;this any good? &lt;BR /&gt;
&lt;A href="https://regex101.com/r/lN5sA6/1"&gt;https://regex101.com/r/lN5sA6/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;think this would translate into something like: &lt;BR /&gt;
&lt;CODE&gt;rex field="CDATA\[(?P[X]..)"&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jul 2015 23:48:26 GMT</pubDate>
    <dc:creator>HattrickNZ</dc:creator>
    <dc:date>2015-07-29T23:48:26Z</dc:date>
    <item>
      <title>Why is my rex command not extracting the field from my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146732#M40989</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;My rex is not giving any results.  I want to extract "XXX" from the below highlighted area. I used  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "\"CommO\" type=\"string\"\&amp;gt;\&amp;lt;\!\[CDATA\[(?&amp;lt;Owner&amp;gt;.*)\] - "
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but not giving any results. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;name="activationtype" type="string"&amp;gt;&amp;lt;![CDATA[Activate]]&amp;gt;&amp;lt;/Property&amp;gt;&amp;lt;Property name="Label" type="string"&amp;gt;&amp;lt;![CDATA[r315107961a]]&amp;gt;&amp;lt;/Property&amp;gt;&amp;lt;Property name="Description" type="string"&amp;gt;&amp;lt;![CDATA[315107961 Verbreitung der Altersvorsorge 2015]]&amp;gt;&amp;lt;/Property&amp;gt;&amp;lt;Property name="CommO" type="string"&amp;gt;&amp;lt;![CDATA[XXX]]&amp;gt;&amp;lt;/Property&amp;gt;&amp;lt;Property name="CommissioningCountry" type="string"&amp;gt;&amp;lt;![CDATA[DEU--Germany]]&amp;gt;&amp;lt;/Property&amp;gt;&amp;lt;Property name="groupname" type="string"&amp;gt;&amp;lt;![CDATA[]]&amp;gt;&amp;lt;/Property&amp;gt;&amp;lt;Property name="cluster" type="string"&amp;gt;&amp;lt;![CDATA[Slo-V]]&amp;gt;&amp;lt;/Property&amp;gt;&amp;lt;Property name="clientid"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2015 09:10:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146732#M40989</guid>
      <dc:creator>Laya123</dc:creator>
      <dc:date>2015-07-29T09:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my rex command not extracting the field from my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146733#M40990</link>
      <description>&lt;P&gt;Try this (used your sample data as input)&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| gentimes start=-1 | eval temp="name=\"activationtype\" type=\"string\"&amp;gt;&amp;lt;\!\[CDATA\[(?[^\]]*)\]"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2015 15:14:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146733#M40990</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-07-29T15:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my rex command not extracting the field from my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146734#M40991</link>
      <description>&lt;P&gt;this any good? &lt;BR /&gt;
&lt;A href="https://regex101.com/r/lN5sA6/1"&gt;https://regex101.com/r/lN5sA6/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;think this would translate into something like: &lt;BR /&gt;
&lt;CODE&gt;rex field="CDATA\[(?P[X]..)"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2015 23:48:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146734#M40991</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-07-29T23:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my rex command not extracting the field from my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146735#M40992</link>
      <description>&lt;P&gt;Hi Laya123,&lt;/P&gt;

&lt;P&gt;you got it almost correct &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; Just remove the trailing &lt;CODE&gt;-&lt;/CODE&gt; and add a &lt;CODE&gt;?&lt;/CODE&gt; and it's good....like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=_raw "\"CommO\" type=\"string\"\&amp;gt;\&amp;lt;\!\[CDATA\[(?&amp;lt;Owner&amp;gt;.*?)\]" | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 01:21:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146735#M40992</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-07-30T01:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my rex command not extracting the field from my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146736#M40993</link>
      <description>&lt;P&gt;The term CDATA comes from the SGML world, which is the complex predecessor of XML. The term is short for Character Data and means that the data contains of characters, and should not be parsed. Tags, entities, attributes, processing instructions inside CDATA are treated as text, not as XML elements.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 01:37:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146736#M40993</guid>
      <dc:creator>krishnacasso</dc:creator>
      <dc:date>2015-07-30T01:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my rex command not extracting the field from my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146737#M40994</link>
      <description>&lt;P&gt;Thank you so much. Its working&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 09:03:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146737#M40994</guid>
      <dc:creator>Laya123</dc:creator>
      <dc:date>2015-07-30T09:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my rex command not extracting the field from my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146738#M40995</link>
      <description>&lt;P&gt;Can you explain me. why we have to use '?'&lt;/P&gt;

&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 09:15:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146738#M40995</guid>
      <dc:creator>Laya123</dc:creator>
      <dc:date>2015-07-30T09:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my rex command not extracting the field from my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146739#M40996</link>
      <description>&lt;P&gt;+1 for using &lt;CODE&gt;[^\]]&lt;/CODE&gt; this is way more efficient than .*? &lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 09:58:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146739#M40996</guid>
      <dc:creator>aholzel</dc:creator>
      <dc:date>2015-07-30T09:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my rex command not extracting the field from my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146740#M40997</link>
      <description>&lt;P&gt;the ? makes the regex non greedy but it is better to use the solution posted below by @somesoni2 that is more efficient. it takes less steps to find the match, it the data between the CDATA brackets gets longer the impact on the searchhead of the solution below is less than this solution.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 10:01:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146740#M40997</guid>
      <dc:creator>aholzel</dc:creator>
      <dc:date>2015-07-30T10:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my rex command not extracting the field from my data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146741#M40998</link>
      <description>&lt;P&gt;You're right this would be better, if it would work. This is more likely to work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval temp="name=\"activationtype\" type=\"string\"&amp;gt;&amp;lt;![CDATA[Activate]]&amp;gt;&amp;lt;/Property&amp;gt;&amp;lt;Property name=\"Label\" type=\"string\"&amp;gt;&amp;lt;![CDATA[r315107961a]]&amp;gt;&amp;lt;/Property&amp;gt;&amp;lt;Property name=\"Description\" type=\"string\"&amp;gt;&amp;lt;![CDATA[315107961 Verbreitung der Altersvorsorge 2015]]&amp;gt;&amp;lt;/Property&amp;gt;&amp;lt;Property name=\"CommO\" type=\"string\"&amp;gt;&amp;lt;![CDATA[XXX]]&amp;gt;&amp;lt;/Property&amp;gt;&amp;lt;Property name=\"CommissioningCountry\" type=\"string\"&amp;gt;&amp;lt;![CDATA[DEU--Germany]]&amp;gt;&amp;lt;/Property&amp;gt;&amp;lt;Property name=\"groupname\" type=\"string\"&amp;gt;&amp;lt;![CDATA[]]&amp;gt;&amp;lt;/Property&amp;gt;&amp;lt;Property name=\"cluster\" type=\"string\"&amp;gt;&amp;lt;![CDATA[Slo-V]]&amp;gt;&amp;lt;/Property&amp;gt;&amp;lt;Property name=\"clientid\"" | rex field=temp "\"CommO\" type=\"string\"&amp;gt;&amp;lt;\!\[CDATA\[(?&amp;lt;Owner&amp;gt;[^\]]*)\]"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Jul 2015 22:03:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-rex-command-not-extracting-the-field-from-my-data/m-p/146741#M40998</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-07-30T22:03:21Z</dc:date>
    </item>
  </channel>
</rss>

