<?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: Use split function for two conditions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-split-function-for-two-conditions/m-p/629794#M218794</link>
    <description>&lt;P&gt;Consider normalizing the data before splitting it.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval domain=replace(domain, ", ", "/")
| eval domain=split(domain,"/")&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 06 Feb 2023 21:12:39 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2023-02-06T21:12:39Z</dc:date>
    <item>
      <title>Using split function for two conditions?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-split-function-for-two-conditions/m-p/629785#M218788</link>
      <description>&lt;P&gt;So I have a field named "domain" that has values of single domains (A, B, C) and combinations of domains with two different values.&lt;/P&gt;
&lt;P&gt;A&lt;BR /&gt;B&lt;BR /&gt;C&lt;BR /&gt;A/B&lt;BR /&gt;A/C&lt;BR /&gt;A, B&lt;BR /&gt;C, D&lt;BR /&gt;I can successfully split the values by either "," or "/" with eval new_field1=(domain,",") but if I do another one after with&amp;nbsp;&lt;SPAN&gt;eval new_field1=(domain,"/") or&amp;nbsp;eval new_field2=(new_field1,"/") after it doesn't work.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Is there a way to split by both "," and "/"&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 22:19:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-split-function-for-two-conditions/m-p/629785#M218788</guid>
      <dc:creator>michaeler</dc:creator>
      <dc:date>2023-02-06T22:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Use split function for two conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-split-function-for-two-conditions/m-p/629791#M218791</link>
      <description>&lt;P&gt;Figured it out...&lt;/P&gt;&lt;P&gt;| eval Ds=split(domain, ",")&lt;BR /&gt;| mvexpand Ds&lt;BR /&gt;| eval Domain=split(Ds, "/")&lt;BR /&gt;| mvexpand Domain&lt;/P&gt;&lt;P&gt;If there is another solution to this I'd love to learn a better way.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 21:04:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-split-function-for-two-conditions/m-p/629791#M218791</guid>
      <dc:creator>michaeler</dc:creator>
      <dc:date>2023-02-06T21:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Use split function for two conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-split-function-for-two-conditions/m-p/629794#M218794</link>
      <description>&lt;P&gt;Consider normalizing the data before splitting it.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval domain=replace(domain, ", ", "/")
| eval domain=split(domain,"/")&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 06 Feb 2023 21:12:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-split-function-for-two-conditions/m-p/629794#M218794</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-02-06T21:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Use split function for two conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-split-function-for-two-conditions/m-p/629808#M218801</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225681"&gt;@michaeler&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can do it with a rex statement and a single mvexpand, e.g.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=domain max_match=0 "\s?(?&amp;lt;Ds&amp;gt;[^,/]*)([,/])?"
| mvexpand Ds&lt;/LI-CODE&gt;&lt;P&gt;The regex will strip out all leading spaces (e.g. the space in your example) and then break out all the matches terminated by either , or /&lt;/P&gt;&lt;P&gt;max_match=0 means it will find all possible matches and make the result an MV field, you can then expand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 23:18:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-split-function-for-two-conditions/m-p/629808#M218801</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-02-06T23:18:14Z</dc:date>
    </item>
  </channel>
</rss>

