<?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 match if else style in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rex-match-if-else-style/m-p/657742#M227173</link>
    <description>&lt;P&gt;The desired extractions are inconsistent.&amp;nbsp; The first two want everything after the domain, but the third wants only the first segment after the domain.&amp;nbsp; Please specify the rules for extracting URI_ABR.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Sep 2023 16:49:46 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2023-09-15T16:49:46Z</dc:date>
    <item>
      <title>Rex match if else style</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-match-if-else-style/m-p/657736#M227169</link>
      <description>&lt;P&gt;Here are three lines of the file to illustrate what I'm going for:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN class=""&gt;Line from file&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;Desired field&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;SPAN class=""&gt;URI&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class=""&gt;&lt;A href="https://URL.net/token" target="_blank" rel="noopener"&gt;https://URL.net/token&lt;/A&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;token&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;SPAN class=""&gt;URI&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class=""&gt;&lt;A href="https://URL.net/rest/v1/check" target="_blank" rel="noopener"&gt;https://URL.net/rest/v1/check&lt;/A&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;SPAN class=""&gt;rest/v1/check&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;&lt;SPAN class=""&gt;URI&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class=""&gt;:&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class=""&gt;&lt;A href="https://URL.net/service_name/3.0.0/accounts/bah" target="_blank" rel="noopener"&gt;https://URL.net/service_name/3.0.0/accounts/bah&lt;/A&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="50%"&gt;&lt;SPAN class=""&gt;service_name&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;I have successfully extracted the 3rd example using this:&amp;nbsp;&lt;BR /&gt;rex field=_raw "URI.+\:\shttp.+\.(net|com)\/(?&amp;lt;URI_ABR&amp;gt;.+)\/\d+\."&lt;BR /&gt;&lt;BR /&gt;That does not match the other two though so no field is extracted. Is there a way to say if it doesn't match that regex then capture till the end of line?&lt;BR /&gt;&lt;BR /&gt;I've tried this but then the 3rd example also captures everything till the end of the line:&lt;BR /&gt;rex field=_raw "URI.+\:\shttp.+\.(net|com)\/(?&amp;lt;URI_ABR&amp;gt;.+)(\/\d+\.|\n)"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 15:13:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-match-if-else-style/m-p/657736#M227169</guid>
      <dc:creator>jeck11</dc:creator>
      <dc:date>2023-09-15T15:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Rex match if else style</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-match-if-else-style/m-p/657742#M227173</link>
      <description>&lt;P&gt;The desired extractions are inconsistent.&amp;nbsp; The first two want everything after the domain, but the third wants only the first segment after the domain.&amp;nbsp; Please specify the rules for extracting URI_ABR.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 16:49:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-match-if-else-style/m-p/657742#M227173</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-09-15T16:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Rex match if else style</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-match-if-else-style/m-p/657758#M227174</link>
      <description>&lt;P&gt;Unfortunately, there are two different rules at play. One needs everything after the URL and the other only needs the URI which is a service name. That's what I've been struggling with.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 17:52:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-match-if-else-style/m-p/657758#M227174</guid>
      <dc:creator>jeck11</dc:creator>
      <dc:date>2023-09-15T17:52:07Z</dc:date>
    </item>
  </channel>
</rss>

