<?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: Regex to extract multiple fields from single event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-multiple-fields-from-single-event/m-p/335608#M99673</link>
    <description>&lt;P&gt;Please check this - &lt;BR /&gt;
&lt;CODE&gt;sourcetype=sample | rex field=_raw "^(?:[^\|\n]*\|){2}(?P&amp;lt;string1&amp;gt;\w+)(?:[^ \n]* ){3}\|(?P&amp;lt;string2&amp;gt;\s+)" | table string1 string2 _raw&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3035iBB0D9131CB614199/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jun 2017 12:04:08 GMT</pubDate>
    <dc:creator>inventsekar</dc:creator>
    <dc:date>2017-06-05T12:04:08Z</dc:date>
    <item>
      <title>Regex to extract multiple fields from single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-multiple-fields-from-single-event/m-p/335606#M99671</link>
      <description>&lt;P&gt;Hi, I want to extract particular fields from single event based on fields position.&lt;/P&gt;

&lt;P&gt;Sample Data:&lt;/P&gt;

&lt;P&gt;event1:  aaa|bbb|ccc|234|    |  f5h   |    |tgvsfj| jhsfj|    |   |   |  6384;&lt;BR /&gt;
event2:  aaa|ggg|hhh|56f|    |  563   |    |dhr| jhsfj|    |   |   |  6385;&lt;/P&gt;

&lt;P&gt;Now, I want to extract 3rd field(i.e ccc) and 7th field(i.e some spaces,nodata)&lt;/P&gt;

&lt;P&gt;My data may include spaces.&lt;/P&gt;

&lt;P&gt;I need regex to extract those fields only.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 11:41:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-multiple-fields-from-single-event/m-p/335606#M99671</guid>
      <dc:creator>gvnd</dc:creator>
      <dc:date>2017-06-05T11:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to extract multiple fields from single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-multiple-fields-from-single-event/m-p/335607#M99672</link>
      <description>&lt;P&gt;You see each field is a set of characters which is "NOT |" followed by a "|".&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "([^\|]*\|){2}(?&amp;lt;thirdField&amp;gt;[^\|]*)\|([^\|]*\|){3}(?&amp;lt;seventhField&amp;gt;[^\|]*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Test regular expressions using &lt;A href="https://regex101.com/r/Odnybw/1"&gt;https://regex101.com/r/Odnybw/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 11:57:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-multiple-fields-from-single-event/m-p/335607#M99672</guid>
      <dc:creator>dineshraj9</dc:creator>
      <dc:date>2017-06-05T11:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to extract multiple fields from single event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-multiple-fields-from-single-event/m-p/335608#M99673</link>
      <description>&lt;P&gt;Please check this - &lt;BR /&gt;
&lt;CODE&gt;sourcetype=sample | rex field=_raw "^(?:[^\|\n]*\|){2}(?P&amp;lt;string1&amp;gt;\w+)(?:[^ \n]* ){3}\|(?P&amp;lt;string2&amp;gt;\s+)" | table string1 string2 _raw&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3035iBB0D9131CB614199/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 12:04:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-multiple-fields-from-single-event/m-p/335608#M99673</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2017-06-05T12:04:08Z</dc:date>
    </item>
  </channel>
</rss>

