<?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 How come my rex command doesn't give results as expected? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-come-my-rex-command-doesn-t-give-results-as-expected/m-p/389896#M113597</link>
    <description>&lt;P&gt;I have the following log statement and I would like to retrieve the mac address which is a 12 digit string from it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;msgType=notifications notification={"device":"mac:Ab12Cd34nm67","cam":"{\"mac\":\"Ab:12:Cd:34:nm:67\",\"Number\":\"AAAAAAAAA\",.....}"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried with&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; host=host* source="source.log" "msgType=notifications*" | rex "(?&amp;lt;mac:.{12})&amp;gt;"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm looking for the string &lt;CODE&gt;mac:Ab12Cd34nm67&lt;/CODE&gt;. How can change the regex to obtain the expected string?&lt;/P&gt;</description>
    <pubDate>Wed, 03 Apr 2019 18:47:51 GMT</pubDate>
    <dc:creator>ananth402</dc:creator>
    <dc:date>2019-04-03T18:47:51Z</dc:date>
    <item>
      <title>How come my rex command doesn't give results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-come-my-rex-command-doesn-t-give-results-as-expected/m-p/389896#M113597</link>
      <description>&lt;P&gt;I have the following log statement and I would like to retrieve the mac address which is a 12 digit string from it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;msgType=notifications notification={"device":"mac:Ab12Cd34nm67","cam":"{\"mac\":\"Ab:12:Cd:34:nm:67\",\"Number\":\"AAAAAAAAA\",.....}"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried with&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; host=host* source="source.log" "msgType=notifications*" | rex "(?&amp;lt;mac:.{12})&amp;gt;"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm looking for the string &lt;CODE&gt;mac:Ab12Cd34nm67&lt;/CODE&gt;. How can change the regex to obtain the expected string?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 18:47:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-come-my-rex-command-doesn-t-give-results-as-expected/m-p/389896#M113597</guid>
      <dc:creator>ananth402</dc:creator>
      <dc:date>2019-04-03T18:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: How come my rex command doesn't give results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-come-my-rex-command-doesn-t-give-results-as-expected/m-p/389897#M113598</link>
      <description>&lt;P&gt;tried using &lt;CODE&gt;host=host* source="source.log" "msgType=notifications*" | rex "mac:(?&amp;lt;mac_number&amp;gt;)"  | stats count by mac_number&lt;/CODE&gt; doesn't give me any results&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 19:07:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-come-my-rex-command-doesn-t-give-results-as-expected/m-p/389897#M113598</guid>
      <dc:creator>ananth402</dc:creator>
      <dc:date>2019-04-03T19:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: How come my rex command doesn't give results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-come-my-rex-command-doesn-t-give-results-as-expected/m-p/389898#M113599</link>
      <description>&lt;P&gt;Try like this  &lt;STRONG&gt;updated&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; host=host* source="source.log" "msgType=notifications*" | rex "mac\:(?&amp;lt;mac&amp;gt;.{12})"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Apr 2019 19:07:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-come-my-rex-command-doesn-t-give-results-as-expected/m-p/389898#M113599</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-04-03T19:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: How come my rex command doesn't give results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-come-my-rex-command-doesn-t-give-results-as-expected/m-p/389899#M113600</link>
      <description>&lt;P&gt;There seems to be an issue with the regex statement because it shows &lt;CODE&gt;Premature end of data in tag form line 1&lt;/CODE&gt; when I try to use it&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 19:12:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-come-my-rex-command-doesn-t-give-results-as-expected/m-p/389899#M113600</guid>
      <dc:creator>ananth402</dc:creator>
      <dc:date>2019-04-03T19:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: How come my rex command doesn't give results as expected?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-come-my-rex-command-doesn-t-give-results-as-expected/m-p/389900#M113601</link>
      <description>&lt;P&gt;Yeah.. missed removing a &lt;CODE&gt;&amp;gt;&lt;/CODE&gt;. Try the updated answer.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 19:17:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-come-my-rex-command-doesn-t-give-results-as-expected/m-p/389900#M113601</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-04-03T19:17:43Z</dc:date>
    </item>
  </channel>
</rss>

