<?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 extract LAT and LONG from a string? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-LAT-and-LONG-from-a-string/m-p/220980#M64932</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;My proposal that includes case insensitive checks and non-greedy evaluation:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=Address "(?i)^Address=(?&amp;lt;Address&amp;gt;.+?)\s+LAT:\s*(?&amp;lt;LAT&amp;gt;[\-\d\.]+)\s+LON:\s*(?&amp;lt;LON&amp;gt;[\-\d\.]+)\s*$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 24 Feb 2016 16:48:29 GMT</pubDate>
    <dc:creator>javiergn</dc:creator>
    <dc:date>2016-02-24T16:48:29Z</dc:date>
    <item>
      <title>How to extract LAT and LONG from a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-LAT-and-LONG-from-a-string/m-p/220978#M64930</link>
      <description>&lt;P&gt;Hi all.&lt;/P&gt;

&lt;P&gt;I have a field with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Address=DG 14 KR 36 A 90 LAT:14.752811 LON:-79.543
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to create three fields from here:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Address=DG 14 KR 36 A 90
LAT=14.752811
LON=-79.543
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I know the regexes for LAT and LONG:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;For LAT: (?&amp;lt;=LAT:)(-?\d+\.\d+)
For LON: (?&amp;lt;=LON:)([\d.-]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Address must be all the string before LAT word.&lt;/P&gt;

&lt;P&gt;I tried to LAT and LON:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | field="Address" "(?&amp;lt;LAT&amp;gt;.(?&amp;lt;=LAT:)(-?\d+\.\d+))\.(?&amp;lt;LON&amp;gt;.(?&amp;lt;=LON:)([\d.-]+))"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But doesn't work. Any idea? Also, I need extract the address.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 16:19:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-LAT-and-LONG-from-a-string/m-p/220978#M64930</guid>
      <dc:creator>changux</dc:creator>
      <dc:date>2016-02-24T16:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract LAT and LONG from a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-LAT-and-LONG-from-a-string/m-p/220979#M64931</link>
      <description>&lt;P&gt;Hi changux, try this regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^Address=(?&amp;lt;address&amp;gt;.*)\sLAT:(?&amp;lt;lat&amp;gt;.*)\sLON:(?&amp;lt;lon&amp;gt;.*)$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you can do inline field extraction after you've gotten the initial events by piping to the rex command like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=Address "^Address=(?&amp;lt;address&amp;gt;.*)\sLAT:(?&amp;lt;lat&amp;gt;.*)\sLON:(?&amp;lt;lon&amp;gt;.*)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please let me know how this goes for you! &lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 16:36:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-LAT-and-LONG-from-a-string/m-p/220979#M64931</guid>
      <dc:creator>muebel</dc:creator>
      <dc:date>2016-02-24T16:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract LAT and LONG from a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-LAT-and-LONG-from-a-string/m-p/220980#M64932</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;My proposal that includes case insensitive checks and non-greedy evaluation:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=Address "(?i)^Address=(?&amp;lt;Address&amp;gt;.+?)\s+LAT:\s*(?&amp;lt;LAT&amp;gt;[\-\d\.]+)\s+LON:\s*(?&amp;lt;LON&amp;gt;[\-\d\.]+)\s*$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Feb 2016 16:48:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-LAT-and-LONG-from-a-string/m-p/220980#M64932</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-02-24T16:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract LAT and LONG from a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-LAT-and-LONG-from-a-string/m-p/220981#M64933</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
try this search code&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ... |rex  field=Address   "(LAT\:(?&amp;lt;LAT&amp;gt;[^\s+]+)\s+(LON\:(?&amp;lt;LON&amp;gt;[^\s+]+)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Feb 2016 13:05:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-LAT-and-LONG-from-a-string/m-p/220981#M64933</guid>
      <dc:creator>chimell</dc:creator>
      <dc:date>2016-02-25T13:05:43Z</dc:date>
    </item>
  </channel>
</rss>

