<?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: Basic Regex Field Extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Basic-Regex-Field-Extraction/m-p/306393#M91976</link>
    <description>&lt;P&gt;The reason your regex is capturing more than you intend is because regexes are greedy by default. So &lt;CODE&gt;(\s.+")&lt;/CODE&gt; will match until the &lt;EM&gt;last&lt;/EM&gt; double-quote it finds. Here's a revised regex that should work for you:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^\"[^"]+\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will look for the double-quotes at the start of the line, collect everything that's not a double-quote followed by the &lt;EM&gt;next&lt;/EM&gt; instance of double-quotes. That prevents the greedy nature from kicking in.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Mar 2018 17:56:48 GMT</pubDate>
    <dc:creator>elliotproebstel</dc:creator>
    <dc:date>2018-03-28T17:56:48Z</dc:date>
    <item>
      <title>Basic Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Basic-Regex-Field-Extraction/m-p/306391#M91974</link>
      <description>&lt;P&gt;I want to extract from "Mozilla" to the closed quotes, pulling everything up to and including 27.0", how come my regex (\s.+") goes all the way to the final quote on the other side of the word analytics.  I know the regex is poor, I'm just trying to get the concept.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0" OBSERVED "Web Ads/Analytics"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Mar 2018 17:37:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Basic-Regex-Field-Extraction/m-p/306391#M91974</guid>
      <dc:creator>JPrictoe</dc:creator>
      <dc:date>2018-03-28T17:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Basic-Regex-Field-Extraction/m-p/306392#M91975</link>
      <description>&lt;P&gt;The &lt;CODE&gt;.+&lt;/CODE&gt; at the end of your  regex is going to go all the way to the end. This should work for the regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Mozilla[^)]*\)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It will include the paren at the end as well, so you can decide if you want to include that.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 17:48:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Basic-Regex-Field-Extraction/m-p/306392#M91975</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2018-03-28T17:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Basic-Regex-Field-Extraction/m-p/306393#M91976</link>
      <description>&lt;P&gt;The reason your regex is capturing more than you intend is because regexes are greedy by default. So &lt;CODE&gt;(\s.+")&lt;/CODE&gt; will match until the &lt;EM&gt;last&lt;/EM&gt; double-quote it finds. Here's a revised regex that should work for you:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^\"[^"]+\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will look for the double-quotes at the start of the line, collect everything that's not a double-quote followed by the &lt;EM&gt;next&lt;/EM&gt; instance of double-quotes. That prevents the greedy nature from kicking in.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 17:56:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Basic-Regex-Field-Extraction/m-p/306393#M91976</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-03-28T17:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Basic Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Basic-Regex-Field-Extraction/m-p/306394#M91977</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;"Mozilla\/(?P&amp;lt;FIELD_NAME&amp;gt;[^"]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As above with the REGEX being greedy, the attached regex will also generate the name for your new field.... just replace "FIELD_NAME" with the desired name of your new field&lt;/P&gt;

&lt;P&gt;As a side note &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt; is a fantastic place to experiment with/hone your REGEX skills&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 13:59:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Basic-Regex-Field-Extraction/m-p/306394#M91977</guid>
      <dc:creator>paulbannister</dc:creator>
      <dc:date>2018-03-29T13:59:35Z</dc:date>
    </item>
  </channel>
</rss>

