<?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: Help using regex to break a comma separated string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480290#M134616</link>
    <description>&lt;P&gt;You don't have to use &lt;CODE&gt;rex&lt;/CODE&gt;.  Another way to do it is to use &lt;CODE&gt;split&lt;/CODE&gt; to break the field at commas then use &lt;CODE&gt;mvindex&lt;/CODE&gt; to grab the second value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval foo=mvindex(split(_raw, ","), 1)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 08 Nov 2019 19:57:05 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2019-11-08T19:57:05Z</dc:date>
    <item>
      <title>Help using regex to break a comma separated string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480288#M134614</link>
      <description>&lt;P&gt;I have a text string field in my events which contains one or many date/time stamps within the string.  The string is comma separated with a leading comma at the beginning of the string and no trailing comma at the end.&lt;/P&gt;

&lt;P&gt;Example String:&lt;/P&gt;

&lt;P&gt;,&lt;STRONG&gt;05-NOV-19 10.24.36.309000 PM AMERICA/CHICAGO&lt;/STRONG&gt;,08-NOV-19 12.30.05.471000 PM AMERICA/CHICAGO,08-NOV-19 12.32.28.525000 PM AMERICA/CHICAGO&lt;/P&gt;

&lt;P&gt;I need help writing a regex/rex statement that will break this string and return only the first date/time stamp as emboldened above.&lt;/P&gt;

&lt;P&gt;Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 19:02:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480288#M134614</guid>
      <dc:creator>mdurdel</dc:creator>
      <dc:date>2019-11-08T19:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: Help using regex to break a comma separated string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480289#M134615</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;Try this &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;|rex field=_raw  \,(?P&amp;lt;Date&amp;gt;[^\s]+) (?P&amp;lt;Time&amp;gt;[^\s]+) | table Date Time&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Anantha.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 19:15:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480289#M134615</guid>
      <dc:creator>Anantha123</dc:creator>
      <dc:date>2019-11-08T19:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help using regex to break a comma separated string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480290#M134616</link>
      <description>&lt;P&gt;You don't have to use &lt;CODE&gt;rex&lt;/CODE&gt;.  Another way to do it is to use &lt;CODE&gt;split&lt;/CODE&gt; to break the field at commas then use &lt;CODE&gt;mvindex&lt;/CODE&gt; to grab the second value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval foo=mvindex(split(_raw, ","), 1)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Nov 2019 19:57:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480290#M134616</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-11-08T19:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: Help using regex to break a comma separated string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480291#M134617</link>
      <description>&lt;P&gt;Hi , I have this regular expression - [^"\n]&lt;EM&gt;"\w+\s+(?P[^"]+)&lt;BR /&gt;
but when I try to do | rex field =_raw "[^"\n]&lt;/EM&gt;"\w+\s+(?P[^"]+)" it doesn't work&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 20:24:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480291#M134617</guid>
      <dc:creator>rashi83</dc:creator>
      <dc:date>2019-11-08T20:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Help using regex to break a comma separated string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480292#M134618</link>
      <description>&lt;P&gt;You just need the first in the list, use max_match=1&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=&amp;lt;your field&amp;gt; max_match=1 ",(?&amp;lt;first_field&amp;gt;[^,]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 09 Nov 2019 19:07:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480292#M134618</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2019-11-09T19:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Help using regex to break a comma separated string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480293#M134619</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=ExistingFieldMaybe_raw "[,\s]+(?&amp;lt;MyCaptureFieldName&amp;gt;[^,]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 09 Nov 2019 23:21:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480293#M134619</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-09T23:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help using regex to break a comma separated string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480294#M134620</link>
      <description>&lt;P&gt;@woodcock...Thank you for the response.  This did work to extract the value I am looking for.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2019 15:01:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480294#M134620</guid>
      <dc:creator>mdurdel</dc:creator>
      <dc:date>2019-11-11T15:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help using regex to break a comma separated string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480295#M134621</link>
      <description>&lt;P&gt;@richgalloway...Thank you for the response. This did work to extract the value I am looking for.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2019 15:02:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480295#M134621</guid>
      <dc:creator>mdurdel</dc:creator>
      <dc:date>2019-11-11T15:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help using regex to break a comma separated string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480296#M134622</link>
      <description>&lt;P&gt;@arjunpkishore5...Thank you for the response. This did work to extract the value I am looking for.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2019 15:05:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480296#M134622</guid>
      <dc:creator>mdurdel</dc:creator>
      <dc:date>2019-11-11T15:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help using regex to break a comma separated string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480297#M134623</link>
      <description>&lt;P&gt;@mdurdel, If your problem is resolved, please accept an answer to help future readers.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Nov 2019 18:22:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480297#M134623</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-11-11T18:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help using regex to break a comma separated string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480298#M134624</link>
      <description>&lt;P&gt;Indeed, I didn't think to solve it with split &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;In this case split vs regex:&lt;/STRONG&gt;&lt;BR /&gt;
"Too easy - let's muddle it up some..."&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2019 13:59:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/480298#M134624</guid>
      <dc:creator>manuelostertag</dc:creator>
      <dc:date>2019-12-20T13:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help using regex to break a comma separated string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/534837#M151151</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While using split I am facing an issue, in my events I have null values for a filed sometimes.&lt;/P&gt;&lt;P&gt;for sexample -&lt;/P&gt;&lt;P&gt;f1,f2,f3,f4,f5 - this works perfectly&lt;/P&gt;&lt;P&gt;but below data with missing values in few fields giving issues.&lt;/P&gt;&lt;P&gt;f1,f2,,,f5&lt;/P&gt;&lt;P&gt;split commands suggests f5 is f4&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can this be handled ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!!!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2021 19:10:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-using-regex-to-break-a-comma-separated-string/m-p/534837#M151151</guid>
      <dc:creator>dchando</dc:creator>
      <dc:date>2021-01-05T19:10:28Z</dc:date>
    </item>
  </channel>
</rss>

