<?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 a string located between two backslashes in a field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229035#M67805</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=proxy github.com cs_uri_path!=/ cs_uri_path=* | rex field=cs_uri_path "\/(?&amp;lt;path&amp;gt;[^\/]+?)\/" |
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 19 Nov 2016 00:12:59 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-11-19T00:12:59Z</dc:date>
    <item>
      <title>How to extract a string located between two backslashes in a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229030#M67800</link>
      <description>&lt;P&gt;Hi guys I'm new to Splunk &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;A search I created returns the following in a specific field:  &lt;CODE&gt;/Erginn008/3e2ce24a277ggh9/e709d1a.json&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I'm looking to extract the &lt;CODE&gt;Erginn008&lt;/CODE&gt; between the first 2 backslashes?&lt;/P&gt;

&lt;P&gt;Any help appreciated thanks. &lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 16:46:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229030#M67800</guid>
      <dc:creator>marktechuk</dc:creator>
      <dc:date>2016-11-15T16:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a string located between two backslashes in a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229031#M67801</link>
      <description>&lt;P&gt;You can do it at search time using &lt;CODE&gt;rex&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=myField "\/(?&amp;lt;newField&amp;gt;[^\/]+)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Nov 2016 16:59:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229031#M67801</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-11-15T16:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a string located between two backslashes in a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229032#M67802</link>
      <description>&lt;P&gt;Thanks Rich, Tried this but getting an error&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=proxy github.com cs_uri_path!=/ cs_uri_path="*" |rex cs_uri_path="*" "\/(?[^\/]+)" |
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Nov 2016 17:12:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229032#M67802</guid>
      <dc:creator>marktechuk</dc:creator>
      <dc:date>2016-11-15T17:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a string located between two backslashes in a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229033#M67803</link>
      <description>&lt;P&gt;rex doesn't make assignments.  The 'field' keyword is literally "field"; replace 'myField' with the name of the field you want to extract from.  So your query becomes&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=proxy github.com cs_uri_path!=/ cs_uri_path="*" |rex field=cs_uri_path "*" "\/(?&amp;lt;newField&amp;gt;[^\/]+)" |
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Nov 2016 22:25:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229033#M67803</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-11-15T22:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a string located between two backslashes in a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229034#M67804</link>
      <description>&lt;P&gt;If following is your data you can use split and mvindex commands in conjunction to split based on backslash and then read first value:&lt;BR /&gt;
fieldName="/Erginn008/3e2ce24a277ggh9/e709d1a.json"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your Base Search Here | eval SplitFields=split(fieldName,"/") | eval firstField=mvindex(SplitFields,1)| table fieldName, SplitFields, firstField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As split command splits fieldName to multivalue field SplitFields, you need to call mvindex command to fetch the first value.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2016 21:31:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229034#M67804</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-11-18T21:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a string located between two backslashes in a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229035#M67805</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=proxy github.com cs_uri_path!=/ cs_uri_path=* | rex field=cs_uri_path "\/(?&amp;lt;path&amp;gt;[^\/]+?)\/" |
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 Nov 2016 00:12:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229035#M67805</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-11-19T00:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a string located between two backslashes in a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229036#M67806</link>
      <description>&lt;P&gt;@marktechuk - Did one of the answers below help provide a solution your question? If yes, please click “Accept” below the best answer to resolve this post. If no, please leave a comment with more feedback. Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 04:20:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-string-located-between-two-backslashes-in-a/m-p/229036#M67806</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2016-11-30T04:20:42Z</dc:date>
    </item>
  </channel>
</rss>

