<?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 substring from a string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-from-a-string/m-p/311772#M93417</link>
    <description>&lt;P&gt;You can try the following (this is very generic high leve regular expression which you might need to tweak based on your actual sample data):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "\(generic:(?&amp;lt;myField&amp;gt;[^\)].*)\)\("
| table _raw myField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Test out your regular expression on regex101.com with more sample data.&lt;BR /&gt;
Also it is better if you create Field through Interactive Field Extraction (IFX), so that Splunk creates regular expression automatically based on sample data. Field Extraction Knowledge Object will serve better with re-usability and easy maintenance.&lt;/P&gt;

&lt;P&gt;Step by Step documentation link : &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ExtractfieldsinteractivelywithIFX"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ExtractfieldsinteractivelywithIFX&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jul 2017 06:13:00 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-07-13T06:13:00Z</dc:date>
    <item>
      <title>How to extract substring from a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-from-a-string/m-p/311771#M93416</link>
      <description>&lt;P&gt;Hi Everyone, &lt;BR /&gt;
I have a string field that contains similar values as given below:&lt;BR /&gt;&lt;BR /&gt;
String = This is the string (generic:ggmail.com)(3245612) &lt;BR /&gt;
       = This is the string (generic:abcdexadsfsdf.cc)(1232143)&lt;/P&gt;

&lt;P&gt;I want to extract only &lt;STRONG&gt;ggmail.com&lt;/STRONG&gt; and &lt;STRONG&gt;abcdexadsfsdf.cc&lt;/STRONG&gt;  and remove strings before and after that.&lt;/P&gt;

&lt;P&gt;Basically if you can notice I want string that comes inside ":" and ")"   like :&lt;STRONG&gt;ggmail.com&lt;/STRONG&gt;)  &lt;/P&gt;

&lt;P&gt;May need to use regex.  If someone can help me out, Thanks in advance. &lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Binay &lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 04:32:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-from-a-string/m-p/311771#M93416</guid>
      <dc:creator>bagarwal</dc:creator>
      <dc:date>2017-07-13T04:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract substring from a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-from-a-string/m-p/311772#M93417</link>
      <description>&lt;P&gt;You can try the following (this is very generic high leve regular expression which you might need to tweak based on your actual sample data):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "\(generic:(?&amp;lt;myField&amp;gt;[^\)].*)\)\("
| table _raw myField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Test out your regular expression on regex101.com with more sample data.&lt;BR /&gt;
Also it is better if you create Field through Interactive Field Extraction (IFX), so that Splunk creates regular expression automatically based on sample data. Field Extraction Knowledge Object will serve better with re-usability and easy maintenance.&lt;/P&gt;

&lt;P&gt;Step by Step documentation link : &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ExtractfieldsinteractivelywithIFX"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ExtractfieldsinteractivelywithIFX&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 06:13:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-from-a-string/m-p/311772#M93417</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-07-13T06:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract substring from a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-from-a-string/m-p/311773#M93418</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;try with something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\(generic:(?&amp;lt;Field&amp;gt;[^\)]*)\)\(
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;test it at &lt;A href="https://regex101.com/r/2VG31q/1"&gt;https://regex101.com/r/2VG31q/1&lt;/A&gt;&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 06:43:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-from-a-string/m-p/311773#M93418</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-07-13T06:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract substring from a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-from-a-string/m-p/311774#M93419</link>
      <description>&lt;P&gt;@niketnilay , Thanks a lot.  I tried with Field Extraction and extracted successfully.  This looks very simple now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 04:38:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-from-a-string/m-p/311774#M93419</guid>
      <dc:creator>bagarwal</dc:creator>
      <dc:date>2017-07-14T04:38:47Z</dc:date>
    </item>
  </channel>
</rss>

