<?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: rex - Extracting a string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/rex-Extracting-a-string/m-p/691130#M235368</link>
    <description>&lt;P&gt;Did you want cids to contain that GUID?&lt;BR /&gt;&lt;BR /&gt;Try&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rex field=log ".*customers\s(?&amp;lt;cids&amp;gt;.*)"
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Alternatively, if the GUID is always at the end, following a space, you can even drop the "customers" part:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rex field=log "(?&amp;lt;cids&amp;gt;\S+$)"
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Your example appears to be creating a capture group named "cids" that captures nothing (the first set of parentheses), and then a second non-capturing group that matches what you want (the second set of parentheses).&lt;BR /&gt;This document might help explain in more detail:&lt;BR /&gt;&lt;A href="https://docs.splunk.com/Documentation/SCS/current/Search/AboutSplunkregularexpressions#Capture_groups_in_regular_expressions" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/SCS/current/Search/AboutSplunkregularexpressions#Capture_groups_in_regular_expressions&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jun 2024 23:49:26 GMT</pubDate>
    <dc:creator>P_vandereerden</dc:creator>
    <dc:date>2024-06-19T23:49:26Z</dc:date>
    <item>
      <title>rex - Extracting a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-Extracting-a-string/m-p/691129#M235367</link>
      <description>&lt;P&gt;I want to exact a string 'GUID" from the log right after "customers". This regex expression works in&amp;nbsp;&lt;A href="https://regex101.com/" target="_blank" rel="noopener"&gt;https://regex101.com/&lt;/A&gt;&amp;nbsp;but not in Splunk.&amp;nbsp; My field name is log:&lt;/P&gt;&lt;P&gt;2023-06-19 15:28:01.726 ERROR [communication-service,6e72370er2368b08,6e723709fd368b08] [,,,] 1 --- [container-0-C-1] c.w.r.acc.commservice.sink.ReminderSink : Reminder Message processed, no linked customers aaf60d69-99a9-41f5-a081-032224284066&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=log "(?&amp;lt;cids&amp;gt;).*customers\s(.*)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 12:22:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-Extracting-a-string/m-p/691129#M235367</guid>
      <dc:creator>jrowland1230</dc:creator>
      <dc:date>2024-06-20T12:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: rex - Extracting a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-Extracting-a-string/m-p/691130#M235368</link>
      <description>&lt;P&gt;Did you want cids to contain that GUID?&lt;BR /&gt;&lt;BR /&gt;Try&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rex field=log ".*customers\s(?&amp;lt;cids&amp;gt;.*)"
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Alternatively, if the GUID is always at the end, following a space, you can even drop the "customers" part:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rex field=log "(?&amp;lt;cids&amp;gt;\S+$)"
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Your example appears to be creating a capture group named "cids" that captures nothing (the first set of parentheses), and then a second non-capturing group that matches what you want (the second set of parentheses).&lt;BR /&gt;This document might help explain in more detail:&lt;BR /&gt;&lt;A href="https://docs.splunk.com/Documentation/SCS/current/Search/AboutSplunkregularexpressions#Capture_groups_in_regular_expressions" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/SCS/current/Search/AboutSplunkregularexpressions#Capture_groups_in_regular_expressions&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 23:49:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-Extracting-a-string/m-p/691130#M235368</guid>
      <dc:creator>P_vandereerden</dc:creator>
      <dc:date>2024-06-19T23:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: rex - Extracting a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-Extracting-a-string/m-p/691169#M235377</link>
      <description>&lt;P&gt;Thank you. I was close ugh.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 12:19:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-Extracting-a-string/m-p/691169#M235377</guid>
      <dc:creator>jrowland1230</dc:creator>
      <dc:date>2024-06-20T12:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: rex - Extracting a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-Extracting-a-string/m-p/691172#M235378</link>
      <description>&lt;P&gt;So to clarify the &amp;lt;cids&amp;gt; is the placeholder for the values produced from the regex AND also the placement is where the actual value would be contained in the string, i.e. Log field?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 12:21:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-Extracting-a-string/m-p/691172#M235378</guid>
      <dc:creator>jrowland1230</dc:creator>
      <dc:date>2024-06-20T12:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: rex - Extracting a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-Extracting-a-string/m-p/691188#M235385</link>
      <description>&lt;P&gt;Yes. You can name multiple capture groups in one rex statement.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rex field=my_field "foo:\s+\"(?&amp;lt;first_capture&amp;gt;[^\"]+)\",\s+bar:\s+(?&amp;lt;second_capture&amp;gt;[^\"]+)"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 20 Jun 2024 15:22:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-Extracting-a-string/m-p/691188#M235385</guid>
      <dc:creator>P_vandereerden</dc:creator>
      <dc:date>2024-06-20T15:22:11Z</dc:date>
    </item>
  </channel>
</rss>

