<?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 with Regex - Removing Text from Field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471858#M132763</link>
    <description>&lt;P&gt;Thanks Giuseppe!&lt;/P&gt;

&lt;P&gt;I'm actually wanting to get rid of everything after the APSA (or any other 3 to 4 alphanumeric value). The field is actually already extracted as LOC.&lt;/P&gt;

&lt;P&gt;So what I get when I run a search is LOC= "3 or 4 character alphanumeric value"&amp;lt; /ParticipantObjectQuery&amp;gt;&amp;lt; /ParticipantObjectIdentification&amp;gt;&amp;lt; /AuditMessage&amp;gt;&lt;/P&gt;

&lt;P&gt;What I want the results to be is LOC="3 or 4 character alphanumeric value"&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 30 Oct 2019 13:15:45 GMT</pubDate>
    <dc:creator>chrisschum</dc:creator>
    <dc:date>2019-10-30T13:15:45Z</dc:date>
    <item>
      <title>Help with Regex - Removing Text from Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471856#M132761</link>
      <description>&lt;P&gt;I have a field where results are 'some letter &amp;amp; number combination of 3 or 4 characters' that includes txt on the end I want to remove. &lt;/P&gt;

&lt;P&gt;The text is made up of  APSA&amp;lt; /ParticipantObjectQuery&amp;gt;&amp;lt; /ParticipantObjectIdentification&amp;gt;&amp;lt; /AuditMessage&amp;gt;".&lt;/P&gt;

&lt;P&gt;So, how do I get rid of everything after the '3 or 4 character' value, which in this case is 'APSA'?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 11:45:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471856#M132761</guid>
      <dc:creator>chrisschum</dc:creator>
      <dc:date>2019-10-30T11:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex - Removing Text from Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471857#M132762</link>
      <description>&lt;P&gt;Hi chrisschum,&lt;BR /&gt;
I could be more precise if you could share an example of your values and of the values to extract.&lt;BR /&gt;
Anyway, if you field is called &lt;CODE&gt;APSA&lt;/CODE&gt;, you want to extract &lt;CODE&gt;ParticipantObjectQuery&lt;/CODE&gt;, &lt;CODE&gt;ParticipantObjectIdentification&lt;/CODE&gt; and &lt;CODE&gt;AuditMessage&lt;/CODE&gt; fields and an example is &lt;CODE&gt;abc1 de2 fgh3.txt&lt;/CODE&gt;, you could use something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=APSA "^(?&amp;lt;ParticipantObjectQuery&amp;gt;[^ ]*)\s+(?&amp;lt;ParticipantObjectIdentification&amp;gt;[^ ]*)\s+(?&amp;lt;AuditMessage&amp;gt;[^\.]*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can test it at &lt;A href="https://regex101.com/r/j7u1vF/1"&gt;https://regex101.com/r/j7u1vF/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 12:09:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471857#M132762</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-30T12:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex - Removing Text from Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471858#M132763</link>
      <description>&lt;P&gt;Thanks Giuseppe!&lt;/P&gt;

&lt;P&gt;I'm actually wanting to get rid of everything after the APSA (or any other 3 to 4 alphanumeric value). The field is actually already extracted as LOC.&lt;/P&gt;

&lt;P&gt;So what I get when I run a search is LOC= "3 or 4 character alphanumeric value"&amp;lt; /ParticipantObjectQuery&amp;gt;&amp;lt; /ParticipantObjectIdentification&amp;gt;&amp;lt; /AuditMessage&amp;gt;&lt;/P&gt;

&lt;P&gt;What I want the results to be is LOC="3 or 4 character alphanumeric value"&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 13:15:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471858#M132763</guid>
      <dc:creator>chrisschum</dc:creator>
      <dc:date>2019-10-30T13:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex - Removing Text from Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471859#M132764</link>
      <description>&lt;P&gt;Sorry I don'r understand: could you share an example of your data and the result you want?&lt;BR /&gt;
Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 13:19:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471859#M132764</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-30T13:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex - Removing Text from Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471860#M132765</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
As per your comment, If the character is alphanumeric value. Below regex will help you extract.&lt;/P&gt;

&lt;P&gt;| rex field=_raw "(?P[A-Z0-9]{4})"&lt;/P&gt;

&lt;P&gt;Please correct me if my understanding is wrong.&lt;/P&gt;

&lt;P&gt;You can test it : &lt;A href="https://regex101.com/r/j7u1vF/1"&gt;https://regex101.com/r/j7u1vF/1&lt;/A&gt;&lt;BR /&gt;
You can change the value inside parenthesis as per your requirement( I pretend it is 4 character value)&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 14:21:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471860#M132765</guid>
      <dc:creator>kartm2020</dc:creator>
      <dc:date>2019-10-30T14:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex - Removing Text from Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471861#M132766</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | rex field=LOC "^(?&amp;lt;yourValue&amp;gt;[\w]{3,4})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As  long as the 3- to 4- character value is at the beginning of the line this should work.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 14:34:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471861#M132766</guid>
      <dc:creator>wenthold</dc:creator>
      <dc:date>2019-10-30T14:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Regex - Removing Text from Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471862#M132767</link>
      <description>&lt;P&gt;That worked! Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 14:43:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-Regex-Removing-Text-from-Field/m-p/471862#M132767</guid>
      <dc:creator>chrisschum</dc:creator>
      <dc:date>2019-10-30T14:43:38Z</dc:date>
    </item>
  </channel>
</rss>

