<?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 How to extract wordcount from Array? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-wordcount-from-Array/m-p/588945#M103326</link>
    <description>&lt;P&gt;I'm trying to extract the total word count from field1 but am unable to find the correct solution. The format is:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;field1: {'totalWordCount': 44891, 'totalUsers':49, 'usUsers':20, 'publishers':18, 'articlesByCountry': {'CA':124, 'US':50, 'AUS':19, 'NZ':2}, 'publishersbyCountry':{'CA':124, 'US':50, 'AUS':19}}&lt;/LI-CODE&gt;
&lt;P&gt;Theres much MUCH more to this field than I listed above but I am only interested in the total word count. Any idea how to extract this information?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried |rex field=field1 "'totalWordCount': * " but get an error message "The regex "totalWordCount':*' does not extract anything. It should specify at least one name group. Format: (?&amp;lt;name&amp;gt;...).&lt;/P&gt;
&lt;P&gt;Im still new to Splunk so bear with me!&lt;/P&gt;</description>
    <pubDate>Mon, 14 Mar 2022 15:33:43 GMT</pubDate>
    <dc:creator>kkosiur</dc:creator>
    <dc:date>2022-03-14T15:33:43Z</dc:date>
    <item>
      <title>How to extract wordcount from Array?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-wordcount-from-Array/m-p/588945#M103326</link>
      <description>&lt;P&gt;I'm trying to extract the total word count from field1 but am unable to find the correct solution. The format is:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;field1: {'totalWordCount': 44891, 'totalUsers':49, 'usUsers':20, 'publishers':18, 'articlesByCountry': {'CA':124, 'US':50, 'AUS':19, 'NZ':2}, 'publishersbyCountry':{'CA':124, 'US':50, 'AUS':19}}&lt;/LI-CODE&gt;
&lt;P&gt;Theres much MUCH more to this field than I listed above but I am only interested in the total word count. Any idea how to extract this information?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried |rex field=field1 "'totalWordCount': * " but get an error message "The regex "totalWordCount':*' does not extract anything. It should specify at least one name group. Format: (?&amp;lt;name&amp;gt;...).&lt;/P&gt;
&lt;P&gt;Im still new to Splunk so bear with me!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 15:33:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-wordcount-from-Array/m-p/588945#M103326</guid>
      <dc:creator>kkosiur</dc:creator>
      <dc:date>2022-03-14T15:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract wordcount from Array?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-wordcount-from-Array/m-p/588956#M103328</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/243869"&gt;@kkosiur&lt;/a&gt;&lt;/P&gt;&lt;P&gt;try this&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;|rex max_match=0 field=_raw "\"totalWordCount\":(?&amp;lt;totalWordCount&amp;gt;\d+)" |table totalWordCount&lt;/P&gt;&lt;P&gt;you can try the above regex but just a query out of curiosity&amp;nbsp;&lt;/P&gt;&lt;P&gt;is it not if you assign your data as sourcetype _JSON&amp;nbsp; this is a json format data right it should extract the field as field1.totalwordcount and you can simply get the count why try the regex ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 16:35:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-wordcount-from-Array/m-p/588956#M103328</guid>
      <dc:creator>venky1544</dc:creator>
      <dc:date>2022-03-14T16:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract wordcount from Array?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-wordcount-from-Array/m-p/588965#M103329</link>
      <description>&lt;P&gt;Hmm that search didnt work. It returned the error message 'Error in SearchOperator:rex': Usage: regex [field=&amp;lt;field&amp;gt;]&amp;lt;regex&amp;gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately I have no control over how the data is ingested so it seems like I am stuck with rex&lt;/P&gt;</description>
      <pubDate>Mon, 14 Mar 2022 17:05:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-wordcount-from-Array/m-p/588965#M103329</guid>
      <dc:creator>kkosiur</dc:creator>
      <dc:date>2022-03-14T17:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract wordcount from Array?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-wordcount-from-Array/m-p/589040#M103336</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/243869"&gt;@kkosiur&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;oks thats because of the double quotes in my regex your data has single quotes i have changed it&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;|rex max_match=0 field=_raw "\'totalWordCount\':(?&amp;lt;totalWordCount&amp;gt;\d+)" |table totalWordCount&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;try now and incase of error can you&amp;nbsp; paste the complete search what you are running it would be helpful&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 09:09:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-wordcount-from-Array/m-p/589040#M103336</guid>
      <dc:creator>venky1544</dc:creator>
      <dc:date>2022-03-15T09:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract wordcount from Array?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-wordcount-from-Array/m-p/589048#M103337</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/137142"&gt;@venky1544&lt;/a&gt;&amp;nbsp;, this search returned the same error message again. I am running:&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=publishing*&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;|rex max_match=0 field=_raw "\'totalWordCount\':(?&amp;lt;totalWordCount&amp;gt;\d+)"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;|table totalWordCount&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 10:56:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-wordcount-from-Array/m-p/589048#M103337</guid>
      <dc:creator>kkosiur</dc:creator>
      <dc:date>2022-03-15T10:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract wordcount from Array?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-wordcount-from-Array/m-p/589088#M103338</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;there seems to be a space before the number i guess thats why regex was failing try it now and try twice once removing the backend slashes before single quote and once including the backslash with single quotes '&lt;/P&gt;&lt;P&gt;index=publishing*&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;|rex max_match=0 field=_raw "{\'totalWordCount\':\s(?&amp;lt;totalWordCount&amp;gt;\d+)"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;|table totalWordCount&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="venky1544_0-1647348909035.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/18513i4D1D92289417F8AE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="venky1544_0-1647348909035.png" alt="venky1544_0-1647348909035.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 13:06:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-wordcount-from-Array/m-p/589088#M103338</guid>
      <dc:creator>venky1544</dc:creator>
      <dc:date>2022-03-15T13:06:51Z</dc:date>
    </item>
  </channel>
</rss>

