<?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 how to use the rex command to extract data when we have space in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463654#M130702</link>
    <description>&lt;P&gt;Hi have a scenario, where I would like to extract the field OfferCode which has space after and before the code:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;OfferCode : XYZAQERWSD&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Please help with rex command to extract this field OfferCode&lt;/P&gt;</description>
    <pubDate>Fri, 07 Feb 2020 04:55:23 GMT</pubDate>
    <dc:creator>s0m073r</dc:creator>
    <dc:date>2020-02-07T04:55:23Z</dc:date>
    <item>
      <title>how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463654#M130702</link>
      <description>&lt;P&gt;Hi have a scenario, where I would like to extract the field OfferCode which has space after and before the code:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;OfferCode : XYZAQERWSD&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Please help with rex command to extract this field OfferCode&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 04:55:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463654#M130702</guid>
      <dc:creator>s0m073r</dc:creator>
      <dc:date>2020-02-07T04:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463655#M130703</link>
      <description>&lt;P&gt;Sample:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="exce.msg=ServiceException:No valid XXXx for OfferId : ASRDAVS32@#4sdfsf" 
| rex  "OfferId\s:\s(?P&amp;lt;OfferCode&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H2&gt;cf. &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/SearchReference/Makeresults"&gt;makeresults&lt;/A&gt;&lt;/H2&gt;

&lt;P&gt;&lt;CODE&gt;| rex  "OfferId\s:\s(?P&amp;lt;OfferCode&amp;gt;\S+)"&lt;/CODE&gt;&lt;BR /&gt;
Hi, @s0m073r&lt;BR /&gt;
How about this?&lt;/P&gt;

&lt;P&gt;If your default  &lt;CODE&gt;_raw&lt;/CODE&gt; contains your sample code , &lt;CODE&gt;rex&lt;/CODE&gt; works&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 05:01:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463655#M130703</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-07T05:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463656#M130704</link>
      <description>&lt;P&gt;Hi @to4kawa &lt;BR /&gt;
getting this:&lt;BR /&gt;
**&lt;BR /&gt;
Error in 'SearchParser': Missing a search command before '|'. Error at position '84' of search query 'search index=XXXX CheckoutBizException:...{snipped} {errorcontext = OfferId| | rex field}'.**&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 05:07:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463656#M130704</guid>
      <dc:creator>s0m073r</dc:creator>
      <dc:date>2020-02-07T05:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463657#M130705</link>
      <description>&lt;P&gt;@s0m073r&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; {errorcontext = OfferId| | rex field
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;|&lt;/CODE&gt; is double.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 05:13:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463657#M130705</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-07T05:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463658#M130706</link>
      <description>&lt;P&gt;@to4kawa &lt;BR /&gt;
tried with &lt;BR /&gt;
*&lt;EM&gt;rex field=Offers "OfferId\s:\s(?P\S+)" *&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;But there is no field getting created to view the list, I can see no errors though&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 05:18:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463658#M130706</guid>
      <dc:creator>s0m073r</dc:creator>
      <dc:date>2020-02-07T05:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463659#M130707</link>
      <description>&lt;P&gt;@s0m073r&lt;BR /&gt;
Does &lt;CODE&gt;Offers&lt;/CODE&gt; contain "OfferCode : XYZAQERWSD" ?&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;rex "OfferCode\s:\s(?P&amp;lt;OfferCode&amp;gt;\S+)"&lt;/CODE&gt;&lt;BR /&gt;
Is that enough?&lt;/P&gt;

&lt;P&gt;By the way, what's &lt;CODE&gt;OfferId&lt;/CODE&gt; ?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 05:31:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463659#M130707</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-07T05:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463660#M130708</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this also&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval temp="OfferCode : XYZAQERWSD" 
| regex temp="OfferCode\s:" 
| eval result=mvindex(trim(split(temp,":")),-1)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Feb 2020 05:37:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463660#M130708</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2020-02-07T05:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463661#M130709</link>
      <description>&lt;P&gt;I agree. but there is unclear field.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 05:39:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463661#M130709</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-07T05:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463662#M130710</link>
      <description>&lt;P&gt;let me give my complete requirement:&lt;/P&gt;

&lt;P&gt;exce.msg=ServiceException:No valid XXXx for OfferId : ASRDAVS32@#4sdfsf&lt;/P&gt;

&lt;P&gt;can you please now help me getting the extract of the Offerid field alone with the code?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 09:37:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463662#M130710</guid>
      <dc:creator>s0m073r</dc:creator>
      <dc:date>2020-02-07T09:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463663#M130711</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval temp="exce.msg=ServiceException:No valid XXXx for OfferId : ASRDAVS32@#4sdfsf" 
| rex field=temp "OfferId\s+:\s+(?P&amp;lt;id&amp;gt;[^@#]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Feb 2020 09:58:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463663#M130711</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2020-02-07T09:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463664#M130712</link>
      <description>&lt;P&gt;@s0m073r&lt;BR /&gt;
I see, my answer is updated. please confirm.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 09:58:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463664#M130712</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-07T09:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463665#M130713</link>
      <description>&lt;P&gt;Error in 'makeresults' command: This command must be the first command of a search.&lt;BR /&gt;
The search job has failed due to an error. You may be able view the job in the Job Inspector.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 10:24:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463665#M130713</guid>
      <dc:creator>s0m073r</dc:creator>
      <dc:date>2020-02-07T10:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463666#M130714</link>
      <description>&lt;P&gt;Hi  s0m073r,&lt;/P&gt;

&lt;P&gt;Pls try below regex command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field = _raw "\OfferCode\s:\s(?P&amp;lt;OfferCode&amp;gt;[^\s+]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Feb 2020 10:54:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463666#M130714</guid>
      <dc:creator>abhijeet01</dc:creator>
      <dc:date>2020-02-07T10:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463667#M130715</link>
      <description>&lt;P&gt;You no need of makeresults command, here i had used to create dummy event. &lt;CODE&gt;| rex field=temp "OfferId\s+:\s+(?P&amp;lt;id&amp;gt;[^@#]+)"&lt;/CODE&gt; is enough. In that instead of &lt;CODE&gt;temp&lt;/CODE&gt; you give actual field name.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 11:02:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463667#M130715</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2020-02-07T11:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463668#M130716</link>
      <description>&lt;P&gt;An easier way honestly is to use "erex", which is a hidden gem.&lt;/P&gt;

&lt;P&gt;Pipe your search to this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| erex offercode examples="XYZAQERWSD"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Wait for the search to complete, then look at the job inspector. At the top it will provide the regex necessary to find the value you are looking for. Example: &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/8338i24F88EF08CC31308/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;You can also use "counterexamples" to exclude results.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.1/SearchReference/Erex"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.1/SearchReference/Erex&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 15:15:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463668#M130716</guid>
      <dc:creator>codebuilder</dc:creator>
      <dc:date>2020-02-07T15:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463669#M130717</link>
      <description>&lt;P&gt;thank you, it worked.&lt;BR /&gt;
thank you all for helping&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 15:53:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463669#M130717</guid>
      <dc:creator>s0m073r</dc:creator>
      <dc:date>2020-02-07T15:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to use the rex command to extract data when we have space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463670#M130718</link>
      <description>&lt;P&gt;Glad to help!&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2020 15:56:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-the-rex-command-to-extract-data-when-we-have-space/m-p/463670#M130718</guid>
      <dc:creator>codebuilder</dc:creator>
      <dc:date>2020-02-07T15:56:04Z</dc:date>
    </item>
  </channel>
</rss>

