<?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 to edit my regular expression to extract the last IP from my sample string using rex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280680#M84697</link>
    <description>&lt;P&gt;You were almost there. Use like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | rex field=_raw "(?&amp;lt;ip_address&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$" | table  ip_address
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 25 Oct 2016 19:29:06 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-10-25T19:29:06Z</dc:date>
    <item>
      <title>How to edit my regular expression to extract the last IP from my sample string using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280679#M84696</link>
      <description>&lt;P&gt;Hey Guys,&lt;/P&gt;

&lt;P&gt;I have the following output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Server: abc-ij-qwerty88.asdf.xyz.com Address: 10.10.254.97 DNS request timed out. timeout was 2 seconds. DNS request timed out. timeout was 2 seconds. Name: google.com Address: 172.217.20.46
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'd like to extract the Last IP from the string. &lt;/P&gt;

&lt;P&gt;I tried the following search with rex, but it returns a blank result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | rex field=_raw "(?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$)" | table  ip_address
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where did I go wrong?&lt;/P&gt;

&lt;P&gt;Your help is appreciated. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 19:19:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280679#M84696</guid>
      <dc:creator>bakalon</dc:creator>
      <dc:date>2016-10-25T19:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract the last IP from my sample string using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280680#M84697</link>
      <description>&lt;P&gt;You were almost there. Use like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | rex field=_raw "(?&amp;lt;ip_address&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$" | table  ip_address
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Oct 2016 19:29:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280680#M84697</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-25T19:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract the last IP from my sample string using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280681#M84698</link>
      <description>&lt;P&gt;you did not put the name of the tag &lt;CODE&gt;?&amp;lt;ip_address&amp;gt;&lt;/CODE&gt; which you are tabl(ing)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; .... | rex field=_raw "(?&amp;lt;ip_address&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$" | table  ip_address
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Oct 2016 19:29:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280681#M84698</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-10-25T19:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract the last IP from my sample string using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280682#M84699</link>
      <description>&lt;P&gt;There's probably a LF at the end. Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "(?&amp;lt;ip&amp;gt;\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})[\n\t\s]$" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Oct 2016 19:34:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280682#M84699</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-25T19:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract the last IP from my sample string using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280683#M84700</link>
      <description>&lt;P&gt;just move the "$" outside the rex match. &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Rex match should be inside parentheses "(.....)", &lt;/LI&gt;
&lt;LI&gt;and to position the rex match, we can use this anchor "$", (which means at the end of line, ...opposite of "^" - beginning of the line)&lt;/LI&gt;
&lt;/OL&gt;

&lt;PRE&gt; .... | rex field=_raw "(?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$" | table  ip_address&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Oct 2016 19:38:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280683#M84700</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2016-10-25T19:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract the last IP from my sample string using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280684#M84701</link>
      <description>&lt;P&gt;Thank you! This worked for me. What did you mean by an "LF" at the end?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 11:34:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280684#M84701</guid>
      <dc:creator>bakalon</dc:creator>
      <dc:date>2016-10-26T11:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract the last IP from my sample string using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280685#M84702</link>
      <description>&lt;P&gt;I had tried this earlier, but it didn't work for me. Thanks for taking the time to help me!&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 11:35:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280685#M84702</guid>
      <dc:creator>bakalon</dc:creator>
      <dc:date>2016-10-26T11:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract the last IP from my sample string using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280686#M84703</link>
      <description>&lt;P&gt;Sorry, yeah I did use the tag but somehow forgot it when making this post. I tried your query but it produced the same blank results. The first answer solved my issue. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 11:35:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280686#M84703</guid>
      <dc:creator>bakalon</dc:creator>
      <dc:date>2016-10-26T11:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract the last IP from my sample string using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280687#M84704</link>
      <description>&lt;P&gt;Thanks for your help! This didn't work, but the inclusion of [\n\t\s] at the end (1st answer) worked for me. Thanks again for your help. &lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 11:37:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280687#M84704</guid>
      <dc:creator>bakalon</dc:creator>
      <dc:date>2016-10-26T11:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract the last IP from my sample string using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280688#M84705</link>
      <description>&lt;P&gt;Line feed. or line break &lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 11:39:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-last-IP-from-my/m-p/280688#M84705</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-26T11:39:28Z</dc:date>
    </item>
  </channel>
</rss>

