<?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: regex only first occurrance in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/regex-only-first-occurrance/m-p/496708#M138406</link>
    <description>&lt;P&gt;it worked, thanks Pavel&lt;/P&gt;</description>
    <pubDate>Thu, 14 May 2020 13:05:26 GMT</pubDate>
    <dc:creator>sreesh</dc:creator>
    <dc:date>2020-05-14T13:05:26Z</dc:date>
    <item>
      <title>regex only first occurrance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-only-first-occurrance/m-p/496704#M138402</link>
      <description>&lt;P&gt;logs&lt;BR /&gt;
source=/api/docker/docker-snapshot-demo/v2/pdap/pdap-validator-router/manifests/1.0.aws&lt;BR /&gt;
source=/api/docker/docker-snapshot/v2/mode-date/mod-validator-router/manifests/1.0.aws&lt;/P&gt;

&lt;P&gt;we want to extract the first occurrence of string that has min of 1 hyphen and max of 2 hyphens into separate filed.  In above example, only "docker-snapshot-eis" and "docker-snapshot" should be extracted into different filed.&lt;BR /&gt;
tried "\w*[-]\w*" and "\b\w*[-']\w*\b" but has challenge limiting to first occurrence and range specifier.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:24:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-only-first-occurrance/m-p/496704#M138402</guid>
      <dc:creator>sreesh</dc:creator>
      <dc:date>2020-09-30T05:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: regex only first occurrance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-only-first-occurrance/m-p/496705#M138403</link>
      <description>&lt;P&gt;Hello @sreesh,&lt;/P&gt;

&lt;P&gt;please try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^[^\-]+\/([^\/\-]+\-[^\/\-]+\-?[^\/\-]*)\/
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/1DpHfH/1"&gt;https://regex101.com/r/1DpHfH/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 13:26:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-only-first-occurrance/m-p/496705#M138403</guid>
      <dc:creator>PavelP</dc:creator>
      <dc:date>2020-05-13T13:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: regex only first occurrance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-only-first-occurrance/m-p/496706#M138404</link>
      <description>&lt;P&gt;Doing inline field extraction using rex.  The output is a bit different&lt;BR /&gt;
 source=&lt;EM&gt;request.log | rex "(?^[^-]+\/([^\/-]+-[^\/-]+-?[^\/-]&lt;/EM&gt;)\/)" | stats count by Repo&lt;/P&gt;

&lt;P&gt;output&lt;BR /&gt;
20200513125800|0|REQUEST| 10.20.39.233 |non_authenticated_user|GET|/api/docker/docker-login/&lt;/P&gt;

&lt;P&gt;while I require only docker-login in Repo filed.  Other files already extracted using delimeter&lt;BR /&gt;
the Resource field value is /api/docker/docker-login/&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:24:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-only-first-occurrance/m-p/496706#M138404</guid>
      <dc:creator>sreesh</dc:creator>
      <dc:date>2020-09-30T05:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: regex only first occurrance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-only-first-occurrance/m-p/496707#M138405</link>
      <description>&lt;P&gt;@sreesh for inline regex use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=source "^[^\-]+\/(?&amp;lt;Repo&amp;gt;[^\/\-]+\-[^\/\-]+\-?[^\/\-]*)\/"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 May 2020 14:05:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-only-first-occurrance/m-p/496707#M138405</guid>
      <dc:creator>PavelP</dc:creator>
      <dc:date>2020-05-13T14:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: regex only first occurrance</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-only-first-occurrance/m-p/496708#M138406</link>
      <description>&lt;P&gt;it worked, thanks Pavel&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 13:05:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-only-first-occurrance/m-p/496708#M138406</guid>
      <dc:creator>sreesh</dc:creator>
      <dc:date>2020-05-14T13:05:26Z</dc:date>
    </item>
  </channel>
</rss>

