<?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 use regex to obtain a single string from a string sequence? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-obtain-a-single-string-from-a-string/m-p/428034#M122498</link>
    <description>&lt;P&gt;If it's not clear from the above, the piece you need, @Nidd, is to add after whatever search you have to return your rows...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=data "for\s(?&amp;lt;suspect&amp;gt;\d+)\sand\s(?&amp;lt;altSuspect&amp;gt;\d+)"
| table suspect altSuspect
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Those two lines should extract your two fields then create a table out of them for you.&lt;/P&gt;

&lt;P&gt;Happy Splunking!&lt;BR /&gt;
-Rich&lt;/P&gt;</description>
    <pubDate>Mon, 04 Jun 2018 17:10:29 GMT</pubDate>
    <dc:creator>Richfez</dc:creator>
    <dc:date>2018-06-04T17:10:29Z</dc:date>
    <item>
      <title>How to use regex to obtain a single string from a string sequence?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-obtain-a-single-string-from-a-string/m-p/428032#M122496</link>
      <description>&lt;P&gt;I have not used regex in my queries much. Any help in resolving this would be much helpful. &lt;/P&gt;

&lt;P&gt;I have the following log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;INFO | 2018-06-04 09:26:46,449 | EvergreenWorker - starting createSuspects for 262352812954213803 and 266946419581359002
INFO | 2018-06-04 09:26:46,449 | EvergreenWorker - starting createSuspects for 262352812954213903 and 266946419581359003
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I wish to obtain the following result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;----------------------------------------------
suspect            |    altSuspect
----------------------------------------------
262352812954213803  |   266946419581359002
262352812954213903  |   266946419581359003
----------------------------------------------
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i.e. The IDs obtained on the logs as suspect and altSuspect.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 16:38:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-obtain-a-single-string-from-a-string/m-p/428032#M122496</guid>
      <dc:creator>Nidd</dc:creator>
      <dc:date>2018-06-04T16:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex to obtain a single string from a string sequence?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-obtain-a-single-string-from-a-string/m-p/428033#M122497</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count =1 
| eval data = " INFO | 2018-06-04 09:26:46,449 | EvergreenWorker - starting createSuspects for 262352812954213803 and 266946419581359002
 ;INFO | 2018-06-04 09:26:46,449 | EvergreenWorker - starting createSuspects for 262352812954213903 and 266946419581359003"
| makemv delim=";" data 
| mvexpand data
| rex field=data "for\s(?&amp;lt;suspect&amp;gt;\d+)\sand\s(?&amp;lt;altSuspect&amp;gt;\d+)"
| table suspect altSuspect
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;screenshot:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="![alt text][1]"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5084iC7FC1A5474837877/image-size/large?v=v2&amp;amp;px=999" role="button" title="![alt text][1]" alt="![alt text][1]" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 17:07:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-obtain-a-single-string-from-a-string/m-p/428033#M122497</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-06-04T17:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex to obtain a single string from a string sequence?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-obtain-a-single-string-from-a-string/m-p/428034#M122498</link>
      <description>&lt;P&gt;If it's not clear from the above, the piece you need, @Nidd, is to add after whatever search you have to return your rows...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=data "for\s(?&amp;lt;suspect&amp;gt;\d+)\sand\s(?&amp;lt;altSuspect&amp;gt;\d+)"
| table suspect altSuspect
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Those two lines should extract your two fields then create a table out of them for you.&lt;/P&gt;

&lt;P&gt;Happy Splunking!&lt;BR /&gt;
-Rich&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 17:10:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-obtain-a-single-string-from-a-string/m-p/428034#M122498</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2018-06-04T17:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex to obtain a single string from a string sequence?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-obtain-a-single-string-from-a-string/m-p/428035#M122499</link>
      <description>&lt;P&gt;Thanks Adonio ! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 05:41:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-obtain-a-single-string-from-a-string/m-p/428035#M122499</guid>
      <dc:creator>Nidd</dc:creator>
      <dc:date>2018-06-05T05:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use regex to obtain a single string from a string sequence?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-obtain-a-single-string-from-a-string/m-p/428036#M122500</link>
      <description>&lt;P&gt;Thank you Rich &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 05:42:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-regex-to-obtain-a-single-string-from-a-string/m-p/428036#M122500</guid>
      <dc:creator>Nidd</dc:creator>
      <dc:date>2018-06-05T05:42:11Z</dc:date>
    </item>
  </channel>
</rss>

