<?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: Regexes and the replace function in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regexes-and-the-replace-function/m-p/86716#M22111</link>
    <description>&lt;P&gt;You could use &lt;CODE&gt;rex&lt;/CODE&gt; with a SEDCMD, similar to this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex mode=sed field=process_name "s/#\d+//"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which is quite similar to what you already have, so I may be barking up the wrong tree...&lt;/P&gt;</description>
    <pubDate>Wed, 07 Mar 2012 16:49:28 GMT</pubDate>
    <dc:creator>dwaddle</dc:creator>
    <dc:date>2012-03-07T16:49:28Z</dc:date>
    <item>
      <title>Regexes and the replace function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regexes-and-the-replace-function/m-p/86715#M22110</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'm wondering if there's a way to trim characters from an unknown field value during search.  I'm tracking perfmon data with Splunk, and when there are multiple instances of a process, they come in as iexplore#1, iexplore#2, etc.  For my particular search, I want to strip any trailing #(number) from the field values and track the combined information about the instances.  The replace function should be what I want, but variations on 'replace "^(\w*)#.&lt;EM&gt;" with $1"' that I've tried don't seem to work.  If I knew the process name in advance I could do 'replace "iexplore#&lt;/EM&gt;" with iexplore', but I don't.  Is there a way to do this?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:29:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regexes-and-the-replace-function/m-p/86715#M22110</guid>
      <dc:creator>cphair</dc:creator>
      <dc:date>2020-09-28T11:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: Regexes and the replace function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regexes-and-the-replace-function/m-p/86716#M22111</link>
      <description>&lt;P&gt;You could use &lt;CODE&gt;rex&lt;/CODE&gt; with a SEDCMD, similar to this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex mode=sed field=process_name "s/#\d+//"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which is quite similar to what you already have, so I may be barking up the wrong tree...&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2012 16:49:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regexes-and-the-replace-function/m-p/86716#M22111</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2012-03-07T16:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Regexes and the replace function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regexes-and-the-replace-function/m-p/86717#M22112</link>
      <description>&lt;P&gt;That's the syntax I was looking for.  Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2012 13:52:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regexes-and-the-replace-function/m-p/86717#M22112</guid>
      <dc:creator>cphair</dc:creator>
      <dc:date>2012-03-08T13:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: Regexes and the replace function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regexes-and-the-replace-function/m-p/86718#M22113</link>
      <description>&lt;P&gt;what part of the regex in this example is the replacement string? I need to do something very similar.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2013 22:13:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regexes-and-the-replace-function/m-p/86718#M22113</guid>
      <dc:creator>aapittts</dc:creator>
      <dc:date>2013-02-21T22:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Regexes and the replace function</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regexes-and-the-replace-function/m-p/86719#M22114</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/176881"&gt;@aapittts&lt;/a&gt;: The part between the first and second slash is the pattern to match, and between the second and third slash is the replacement string.  In this case it's empty because I wanted to get rid of the text entirely, but you could have something like field=process_name "s/foo/bar/" which would replace all occurences of foo in process_name with bar.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:22:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regexes-and-the-replace-function/m-p/86719#M22114</guid>
      <dc:creator>cphair</dc:creator>
      <dc:date>2020-09-28T13:22:35Z</dc:date>
    </item>
  </channel>
</rss>

