<?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: regular expression json in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/regular-expression-json/m-p/423136#M74331</link>
    <description>&lt;P&gt;As @ cpetterborg  says&lt;/P&gt;

&lt;P&gt;If you are trying this at search time all you need to do is add a max_match=0 after your regex, assuming your regex is giving the correct value for 1 extraction... something like `rex field=_raw "(code_key)"\s*:\s*"?(?[\w\d:.-]*?)" max_match=0. Has your rejected got corrupted while pasting here?Bsically just pipe max_match after the regex that successfully extracts the first value.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 20:21:50 GMT</pubDate>
    <dc:creator>Sukisen1981</dc:creator>
    <dc:date>2020-09-29T20:21:50Z</dc:date>
    <item>
      <title>regular expression json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/regular-expression-json/m-p/423132#M74327</link>
      <description>&lt;P&gt;good afternoon&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; I'm trying to capture a particular field, but sometimes my events come several times, and declaring the regular expression only captures a value.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; Any suggestions?&lt;/P&gt;

&lt;P&gt;\"(code_key)\"\s*:\s*\"?(?[\w\d:.-]*)\"?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{ "_id" : { [ { "network_id_key" : "99999999" } ], "avps_key" : [], "services_key" : [ { "enabled_key" : true, "avps_key" : [], "code_key" : "IM_Prepago" } ], "billing_info_key" : {}, "start_date_key" : { "$date" : "2015-01-29T03:50:28.000-0300" }, "realm_key" : null, "name_key" : {}, "end_date_key" : null }

{ "_id" : {[ { "network_id_key" : "99999999" } ], "services_key" : [ { "avps_key" : [], "enabled_key" : true, "code_key" : "IM_Prepago" }, { "avps_key" : null, "enabled_key" : true, "code_key" : "TDE_IM_PP" }, { "code_key" : "TDE_ROAM_DEF", "avps_key" : null, "enabled_key" : true } ], "status_key" : "ACTIVE", "start_date_key" : { "$date" : "2015-01-29T03:50:28.000-0300" } }

{ "_id" : { [ { "avps_key" : [], "enabled_key" : true, "code_key" : "IM_Prepago" }, { "avps_key" : null, "enabled_key" : true, "code_key" : "TDE_IM_PP" }, { "code_key" : "TDE_ROAM_DEF", "avps_key" : null, "enabled_key" : true } ], "status_key" : "ACTIVE", "start_date_key" : { "$date" : "2015-01-29T03:50:28.000-0300" } }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/252156-field1.jpg" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:17:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/regular-expression-json/m-p/423132#M74327</guid>
      <dc:creator>efaundez</dc:creator>
      <dc:date>2020-09-29T20:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: regular expression json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/regular-expression-json/m-p/423133#M74328</link>
      <description>&lt;P&gt;So you are getting ONLY the first match and not the other two, but you want all three?&lt;/P&gt;

&lt;P&gt;And are you wanting to do this at search time (in the search string - e.g.&lt;CODE&gt;rex&lt;/CODE&gt;, or auto field extraction), or at index time?&lt;/P&gt;

&lt;P&gt;Also, for clarity - your regex seems to have gotten a little eaten by the formatting:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"(code_key)"\s*:\s*"?(?&amp;lt;code_key&amp;gt;[\w\d\:.-]*)"?
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I also took a few backslashes out that weren't &lt;STRONG&gt;needed&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jul 2018 20:45:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/regular-expression-json/m-p/423133#M74328</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2018-07-06T20:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: regular expression json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/regular-expression-json/m-p/423134#M74329</link>
      <description>&lt;P&gt;thanks for your reply&lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
&amp;nbsp;&amp;nbsp; Splunk continues only taking into account 1 only value and the others ignore them &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5321iFF42867706E4B268/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5322iBD7B45B281644D5C/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jul 2018 21:31:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/regular-expression-json/m-p/423134#M74329</guid>
      <dc:creator>efaundez</dc:creator>
      <dc:date>2018-07-06T21:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: regular expression json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/regular-expression-json/m-p/423135#M74330</link>
      <description>&lt;P&gt;Again - Are you wanting to do this at search time (in the search string - e.g.&lt;CODE&gt;rex&lt;/CODE&gt;, or auto field extraction), or at index time?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jul 2018 22:35:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/regular-expression-json/m-p/423135#M74330</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2018-07-06T22:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: regular expression json</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/regular-expression-json/m-p/423136#M74331</link>
      <description>&lt;P&gt;As @ cpetterborg  says&lt;/P&gt;

&lt;P&gt;If you are trying this at search time all you need to do is add a max_match=0 after your regex, assuming your regex is giving the correct value for 1 extraction... something like `rex field=_raw "(code_key)"\s*:\s*"?(?[\w\d:.-]*?)" max_match=0. Has your rejected got corrupted while pasting here?Bsically just pipe max_match after the regex that successfully extracts the first value.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:21:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/regular-expression-json/m-p/423136#M74331</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2020-09-29T20:21:50Z</dc:date>
    </item>
  </channel>
</rss>

