<?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: How do you use the rex command to parse out the IP between fix characters? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-the-rex-command-to-parse-out-the-IP-between-fix/m-p/411587#M118725</link>
    <description>&lt;P&gt;Your question is a bit unclear (partly because I think some stuff between &lt;CODE&gt;&amp;lt;&amp;gt;&lt;/CODE&gt; went missing?). Can you please clarify a bit what it is exactly that you want to extract? And please also share the search you have so far.&lt;/P&gt;

&lt;P&gt;Taking my best guess at what you want, wouldn't this do the trick:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\&amp;lt;IpAddress\&amp;gt;(?&amp;lt;IP&amp;gt;\d+\.\d+\.\d+\.\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/JWEbRc/1"&gt;https://regex101.com/r/JWEbRc/1&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Feb 2019 15:44:44 GMT</pubDate>
    <dc:creator>FrankVl</dc:creator>
    <dc:date>2019-02-28T15:44:44Z</dc:date>
    <item>
      <title>How do you use the rex command to parse out the IP between fix characters?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-the-rex-command-to-parse-out-the-IP-between-fix/m-p/411586#M118724</link>
      <description>&lt;P&gt;Hi all, &lt;/P&gt;

&lt;P&gt;I was wondering how can i write a Splunk rex to parse out the IP between two words. &lt;/P&gt;

&lt;P&gt;for example &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;IpAddress&amp;gt;8.8.8.8, 2.2.2.2&amp;lt;/IpAddress&amp;gt;
  &amp;lt;blahblah&amp;gt;1.1.1.1, 2.2.2.2, x.x.x.x&amp;lt;/blahblah&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am able to write a search &lt;/P&gt;

&lt;P&gt;but in results it parses out "8.8.8.8&amp;lt;" and "x.x.x.x&amp;lt;"&lt;/P&gt;

&lt;P&gt;I only care about the first IP address between.    &lt;/P&gt;

&lt;P&gt;I'm looking forward to hearing from you guys.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 15:39:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-the-rex-command-to-parse-out-the-IP-between-fix/m-p/411586#M118724</guid>
      <dc:creator>AbubakarShahid</dc:creator>
      <dc:date>2019-02-28T15:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do you use the rex command to parse out the IP between fix characters?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-the-rex-command-to-parse-out-the-IP-between-fix/m-p/411587#M118725</link>
      <description>&lt;P&gt;Your question is a bit unclear (partly because I think some stuff between &lt;CODE&gt;&amp;lt;&amp;gt;&lt;/CODE&gt; went missing?). Can you please clarify a bit what it is exactly that you want to extract? And please also share the search you have so far.&lt;/P&gt;

&lt;P&gt;Taking my best guess at what you want, wouldn't this do the trick:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\&amp;lt;IpAddress\&amp;gt;(?&amp;lt;IP&amp;gt;\d+\.\d+\.\d+\.\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/JWEbRc/1"&gt;https://regex101.com/r/JWEbRc/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 15:44:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-the-rex-command-to-parse-out-the-IP-between-fix/m-p/411587#M118725</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-02-28T15:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do you use the rex command to parse out the IP between fix characters?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-the-rex-command-to-parse-out-the-IP-between-fix/m-p/411588#M118726</link>
      <description>&lt;P&gt;Hi @AbubakarShahid&lt;/P&gt;

&lt;P&gt;Try this it will extract first ip address&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval str="&amp;lt;blahblah&amp;gt;1.1.1.1, 2.2.2.2, x.x.x.x&amp;lt;/blahblah&amp;gt;" 
| rex field=str "&amp;gt;(?P&amp;lt;ipaddress&amp;gt;\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Feb 2019 15:49:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-use-the-rex-command-to-parse-out-the-IP-between-fix/m-p/411588#M118726</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-02-28T15:49:26Z</dc:date>
    </item>
  </channel>
</rss>

