<?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 Trim string at @ - need help creating rex search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333005#M99035</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I cannot figure out the syntax of the rex function. I have a field called email with multiple domains: &lt;A href="mailto:katz.r@blah.com"&gt;katz.r@blah.com&lt;/A&gt; &lt;A href="mailto:example@blahblah.com"&gt;example@blahblah.com&lt;/A&gt;. I need to create a new field where just katz.r and example are returned- so it is cut off at the @ sign. I cannot figure out the syntax of rex to write it and the split function keeps both the values: katz.r and blah.com-which is not what I want. I also tried rtim but I that isn't working for a field- just a given string. &lt;/P&gt;

&lt;P&gt;Thanks for the help!&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2017 17:24:44 GMT</pubDate>
    <dc:creator>katzr</dc:creator>
    <dc:date>2017-09-12T17:24:44Z</dc:date>
    <item>
      <title>How to Trim string at @ - need help creating rex search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333005#M99035</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I cannot figure out the syntax of the rex function. I have a field called email with multiple domains: &lt;A href="mailto:katz.r@blah.com"&gt;katz.r@blah.com&lt;/A&gt; &lt;A href="mailto:example@blahblah.com"&gt;example@blahblah.com&lt;/A&gt;. I need to create a new field where just katz.r and example are returned- so it is cut off at the @ sign. I cannot figure out the syntax of rex to write it and the split function keeps both the values: katz.r and blah.com-which is not what I want. I also tried rtim but I that isn't working for a field- just a given string. &lt;/P&gt;

&lt;P&gt;Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 17:24:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333005#M99035</guid>
      <dc:creator>katzr</dc:creator>
      <dc:date>2017-09-12T17:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to Trim string at @ - need help creating rex search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333006#M99036</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
why do you want to use regex?&lt;BR /&gt;
try using makemv and mvexpand, something like this&lt;BR /&gt;
    index=_internal | head 1| eval IP="&lt;A href="mailto:katz.r@blah.com"&gt;katz.r@blah.com&lt;/A&gt; &lt;A href="mailto:example@blahblah.com"&gt;example@blahblah.com&lt;/A&gt;" | makemv IP | mvexpand IP | table IP&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 17:34:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333006#M99036</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-09-12T17:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to Trim string at @ - need help creating rex search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333007#M99037</link>
      <description>&lt;P&gt;I need to perform this action for the whole field email- not just those example strings&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 17:38:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333007#M99037</guid>
      <dc:creator>katzr</dc:creator>
      <dc:date>2017-09-12T17:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to Trim string at @ - need help creating rex search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333008#M99038</link>
      <description>&lt;P&gt;Could you share an example to extract fields?&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 17:47:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333008#M99038</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-09-12T17:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to Trim string at @ - need help creating rex search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333009#M99039</link>
      <description>&lt;P&gt;The field is called email and contains values of a typical email. And I want a new field that just includes the portion of the email string before the @. &lt;/P&gt;

&lt;P&gt;So &lt;A href="mailto:katz.r@blahblah.com"&gt;katz.r@blahblah.com&lt;/A&gt; is a value in the field Email. And I want just katz.r in a new field. &lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 17:51:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333009#M99039</guid>
      <dc:creator>katzr</dc:creator>
      <dc:date>2017-09-12T17:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to Trim string at @ - need help creating rex search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333010#M99040</link>
      <description>&lt;P&gt;Thanks for help!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 17:51:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333010#M99040</guid>
      <dc:creator>katzr</dc:creator>
      <dc:date>2017-09-12T17:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to Trim string at @ - need help creating rex search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333011#M99041</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval email="anybody@mail.com" | rex field=email "^(?&amp;lt;firstPart&amp;gt;.*)@" | table email, firstPart
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am assuming your events have a field called 'email' with just one value per event, but across events there are multiple values.&lt;BR /&gt;
If your email field contains multiple email addresses in each event, the approach would be different. So please clarify, if this is not what you need.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 18:11:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333011#M99041</guid>
      <dc:creator>s2_splunk</dc:creator>
      <dc:date>2017-09-12T18:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to Trim string at @ - need help creating rex search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333012#M99042</link>
      <description>&lt;P&gt;So if you just want to isolate the username from the domain in the &lt;CODE&gt;email&lt;/CODE&gt; field into a new field (I'm using &lt;CODE&gt;user&lt;/CODE&gt;), you can do that something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval user=email | rex field=user mode=sed "s/@\S+//g"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Sep 2017 18:42:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333012#M99042</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-09-12T18:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to Trim string at @ - need help creating rex search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333013#M99043</link>
      <description>&lt;P&gt;@katzr, Similar question was asked a day before... &lt;A href="https://answers.splunk.com/answers/569242/having-difficulties-at-search-trying-to-use-sed-to.html"&gt;https://answers.splunk.com/answers/569242/having-difficulties-at-search-trying-to-use-sed-to.html&lt;/A&gt;. @cpetterborg, with accepted answer to that question, has already answered here with his accepted answer using &lt;CODE&gt;sed&lt;/CODE&gt;, following is rex on similar lines but without sed:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | makeresults
 | eval _raw="user@domain.com" 
 | rex "(?&amp;lt;user&amp;gt;[^@]+)@"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Sep 2017 19:03:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-Trim-string-at-need-help-creating-rex-search/m-p/333013#M99043</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-09-12T19:03:46Z</dc:date>
    </item>
  </channel>
</rss>

