<?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 Rex Command with multiple formatting options in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rex-Command-with-multiple-formatting-options/m-p/546384#M154893</link>
    <description>&lt;P&gt;Trying to get the rex command to extract the last name when the user field has multiple formatting outputs below. Is there a way to incorporate both options into a rex command?&lt;/P&gt;&lt;P&gt;| rex field=user "(?&amp;lt;user_last_name&amp;gt;[A-Za-z]+),.*"&amp;nbsp;&lt;/P&gt;&lt;P&gt;Smith, Bob&lt;/P&gt;&lt;P&gt;bob.t.smith.abc&lt;/P&gt;</description>
    <pubDate>Thu, 01 Apr 2021 14:59:08 GMT</pubDate>
    <dc:creator>Dude</dc:creator>
    <dc:date>2021-04-01T14:59:08Z</dc:date>
    <item>
      <title>Rex Command with multiple formatting options</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-Command-with-multiple-formatting-options/m-p/546384#M154893</link>
      <description>&lt;P&gt;Trying to get the rex command to extract the last name when the user field has multiple formatting outputs below. Is there a way to incorporate both options into a rex command?&lt;/P&gt;&lt;P&gt;| rex field=user "(?&amp;lt;user_last_name&amp;gt;[A-Za-z]+),.*"&amp;nbsp;&lt;/P&gt;&lt;P&gt;Smith, Bob&lt;/P&gt;&lt;P&gt;bob.t.smith.abc&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 14:59:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-Command-with-multiple-formatting-options/m-p/546384#M154893</guid>
      <dc:creator>Dude</dc:creator>
      <dc:date>2021-04-01T14:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rex Command with multiple formatting options</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-Command-with-multiple-formatting-options/m-p/546408#M154906</link>
      <description>&lt;P&gt;This regex fits the two examples, but there are many other ways to represent names.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=user "(?J)(?&amp;lt;user_last_name&amp;gt;[A-Za-z]+),.*|[^\.]+\.[^\.]+\.(?&amp;lt;user_last_name&amp;gt;\w+)"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 01 Apr 2021 17:37:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-Command-with-multiple-formatting-options/m-p/546408#M154906</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-04-01T17:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Rex Command with multiple formatting options</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-Command-with-multiple-formatting-options/m-p/546419#M154909</link>
      <description>&lt;P&gt;Each one of the halves work independently or if I create another name group they both work, but for whatever reason the (?J) modifier is not working. Also for the thread I did not know these regex modifiers existed.&amp;nbsp;&amp;nbsp;&lt;A href="https://www.regular-expressions.info/modifiers.html" target="_self"&gt;Regex Modifiers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 18:59:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-Command-with-multiple-formatting-options/m-p/546419#M154909</guid>
      <dc:creator>Dude</dc:creator>
      <dc:date>2021-04-01T18:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Rex Command with multiple formatting options</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-Command-with-multiple-formatting-options/m-p/546429#M154914</link>
      <description>&lt;P&gt;I forgot Splunk doesn't support (?J).&amp;nbsp; Sorry about that.&amp;nbsp; Try this, instead.&amp;nbsp; It extracts separate last name fields and then chooses the one that is not null.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=user "(?J)(?&amp;lt;last_name1&amp;gt;[A-Za-z]+),.*|[^\.]+\.[^\.]+\.(?&amp;lt;last_name2&amp;gt;\w+)"
| eval user_last_name=coalesce(last_name1, last_name2)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 01 Apr 2021 20:07:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-Command-with-multiple-formatting-options/m-p/546429#M154914</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-04-01T20:07:37Z</dc:date>
    </item>
  </channel>
</rss>

