<?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: rex syntax help in Splunk Cloud Platform</title>
    <link>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551280#M663</link>
    <description>&lt;P&gt;I figured it out. This will give me what I want&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Username2 = split(Username, " ")
| eval Username2 = mvindex(Username2, 0) . "." . mvjoin(mvindex(Username2,1,-1),"")&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;This is very complex.&amp;nbsp; Would you be kind enough to provide me a link that you would recommend a novice to study so that I can understand every aspect of the above command?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 May 2021 19:59:31 GMT</pubDate>
    <dc:creator>verifi81</dc:creator>
    <dc:date>2021-05-11T19:59:31Z</dc:date>
    <item>
      <title>rex syntax help</title>
      <link>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551185#M660</link>
      <description>&lt;P&gt;Hi I have a search that his the Field of &lt;STRONG&gt;Username&lt;/STRONG&gt; and 3 sample values&lt;BR /&gt;&lt;BR /&gt;Username&amp;nbsp;&lt;BR /&gt;Bob Marley Peter,&lt;BR /&gt;Sammy Dolphin Green,&lt;BR /&gt;Larry Macy Jr,&lt;/P&gt;&lt;P&gt;I need help with the rex syntax that keeps the first and middle name separate, but joins the middle and last name while dropping the apostophe&lt;/P&gt;&lt;P&gt;In essence, i want the end result to be like this:&lt;/P&gt;&lt;P&gt;Username2&lt;BR /&gt;Bob MarleyPeter&lt;BR /&gt;Sammy DolphinGreen&lt;BR /&gt;Larry MacyJr&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Please help correct this syntax:&lt;BR /&gt;| rex field=blah "(?i)username=(?&amp;lt;username2&amp;gt;[^,]+) | table username2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 07:04:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551185#M660</guid>
      <dc:creator>verifi81</dc:creator>
      <dc:date>2021-05-11T07:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: rex syntax help</title>
      <link>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551190#M661</link>
      <description>&lt;P&gt;Hi, you don't really need rex for that, although you could use rex with sed mode to achieve pretty much the same as this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Username2 = split(Username, " ")
| eval Username2 = mvindex(Username2, 0) . " " . mvjoin(mvindex(Username2,1,-1),"")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Screenshot from my lab:&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="Screenshot 2021-05-11 at 09.22.43.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/14112i6CF7A1E02E40181F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2021-05-11 at 09.22.43.png" alt="Screenshot 2021-05-11 at 09.22.43.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 07:22:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551190#M661</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2021-05-11T07:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: rex syntax help</title>
      <link>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551279#M662</link>
      <description>&lt;P&gt;Javiergn, thank you so much.&lt;/P&gt;&lt;P&gt;I forgot to add a .&lt;/P&gt;&lt;P&gt;What would I add to that to make the results look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Username2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Bob.MarleyPeter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sammy.DolphinGreen&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Larry.MacyJr&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 19:52:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551279#M662</guid>
      <dc:creator>verifi81</dc:creator>
      <dc:date>2021-05-11T19:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: rex syntax help</title>
      <link>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551280#M663</link>
      <description>&lt;P&gt;I figured it out. This will give me what I want&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Username2 = split(Username, " ")
| eval Username2 = mvindex(Username2, 0) . "." . mvjoin(mvindex(Username2,1,-1),"")&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;This is very complex.&amp;nbsp; Would you be kind enough to provide me a link that you would recommend a novice to study so that I can understand every aspect of the above command?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 19:59:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551280#M663</guid>
      <dc:creator>verifi81</dc:creator>
      <dc:date>2021-05-11T19:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: rex syntax help</title>
      <link>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551284#M664</link>
      <description>&lt;P&gt;Sure no problem. The commands are actually relatively simple to understand:&lt;/P&gt;&lt;P&gt;split:&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.3/SearchReference/MultivalueEvalFunctions#split.28X.2C.22Y.22.29" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/8.1.3/SearchReference/MultivalueEvalFunctions#split.28X.2C.22Y.22.29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;mvindex:&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.3/SearchReference/MultivalueEvalFunctions#mvindex.28MVFIELD.2CSTARTINDEX.2C_ENDINDEX.29" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/8.1.3/SearchReference/MultivalueEvalFunctions#mvindex.28MVFIELD.2CSTARTINDEX.2C_ENDINDEX.29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;mvjoin:&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.3/SearchReference/MultivalueEvalFunctions#mvjoin.28MVFIELD.2CSTR.29" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/8.1.3/SearchReference/MultivalueEvalFunctions#mvjoin.28MVFIELD.2CSTR.29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a nutshell, what the code above is doing is:&lt;/P&gt;&lt;P&gt;- Create field Username2 from splitting Username by blank spaces. Which creates a multivalue field (a field with several values, like an array)&lt;/P&gt;&lt;P&gt;- Then update Username2 by taking the first member of the this array with mvindex and join (using mvjoin) with all the remaining members of the array joined by "no space", (the double quotes). Which is the same as saying start at member 1 (remember that first member is 0) and then finish by member -1, which is the last one but without having to precalculate the length of your array.&lt;/P&gt;&lt;P&gt;This code will also work if your users have more than one middle or last name.&lt;/P&gt;&lt;P&gt;I hope that makes sense and if you are happy with the answer please don't forget to accept it as solution so that others can benefit from it.&lt;/P&gt;</description>
      <pubDate>Tue, 11 May 2021 21:13:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551284#M664</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2021-05-11T21:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: rex syntax help</title>
      <link>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551646#M665</link>
      <description>&lt;P&gt;Thank you very much for taking the time to explain this to me.&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 17:58:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551646#M665</guid>
      <dc:creator>verifi81</dc:creator>
      <dc:date>2021-05-14T17:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: rex syntax help</title>
      <link>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551664#M666</link>
      <description>Sure no problem. If you were happy with the answers please don’t forget to upvote them and give karma so that others can find them more easily too. Regards, J</description>
      <pubDate>Fri, 14 May 2021 19:49:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Cloud-Platform/rex-syntax-help/m-p/551664#M666</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2021-05-14T19:49:23Z</dc:date>
    </item>
  </channel>
</rss>

