<?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: Issue using rex to replace string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Issue-using-rex-to-replace-string/m-p/681606#M232918</link>
    <description>&lt;P&gt;Yeah I tried that first, but other related issues on the boards led me to try it with the backslash. It returns the same results.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2024 18:42:13 GMT</pubDate>
    <dc:creator>Scharf</dc:creator>
    <dc:date>2024-03-21T18:42:13Z</dc:date>
    <item>
      <title>Issue using rex to replace string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issue-using-rex-to-replace-string/m-p/681602#M232914</link>
      <description>&lt;P&gt;Hello world,&lt;/P&gt;&lt;P&gt;I'm trying to use rex to rename the part of the strings below where it says "g0" to "GRN". So the output would read 01-GRN1-0, 01-GRN2-0etc. I have been unable to get it to work and any guidance to point me in the right direction would be much appreciated.&lt;BR /&gt;The rex statement in question:&lt;/P&gt;&lt;P&gt;| rex field=ThisField mode=sed "s/g0/\GRN/g"&lt;/P&gt;&lt;P&gt;Example strings:&lt;/P&gt;&lt;P&gt;01-g01-0&lt;/P&gt;&lt;P&gt;01-g02-0&lt;/P&gt;&lt;P&gt;01-g03-0&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 18:29:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issue-using-rex-to-replace-string/m-p/681602#M232914</guid>
      <dc:creator>Scharf</dc:creator>
      <dc:date>2024-03-21T18:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Issue using rex to replace string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issue-using-rex-to-replace-string/m-p/681604#M232916</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;you should remove \ before G.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 18:35:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issue-using-rex-to-replace-string/m-p/681604#M232916</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2024-03-21T18:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Issue using rex to replace string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issue-using-rex-to-replace-string/m-p/681605#M232917</link>
      <description>&lt;P&gt;You don't need the backslash - here is a runanywhere example showing it working&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| fields - _time
| eval ThisField=split("01-g01-0
01-g02-0
01-g03-0","
")
| mvexpand ThisField
| rex field=ThisField mode=sed "s/g0/GRN/g"&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 21 Mar 2024 18:39:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issue-using-rex-to-replace-string/m-p/681605#M232917</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-03-21T18:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Issue using rex to replace string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issue-using-rex-to-replace-string/m-p/681606#M232918</link>
      <description>&lt;P&gt;Yeah I tried that first, but other related issues on the boards led me to try it with the backslash. It returns the same results.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 18:42:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issue-using-rex-to-replace-string/m-p/681606#M232918</guid>
      <dc:creator>Scharf</dc:creator>
      <dc:date>2024-03-21T18:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Issue using rex to replace string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issue-using-rex-to-replace-string/m-p/681609#M232920</link>
      <description>&lt;P&gt;The search works as shown which probably means there is something different in your environment which hasn't been made clear to us. Please can you provide more details and examples of where this substitution is not working as expected?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 18:49:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issue-using-rex-to-replace-string/m-p/681609#M232920</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-03-21T18:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Issue using rex to replace string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Issue-using-rex-to-replace-string/m-p/681613#M232921</link>
      <description>&lt;P&gt;It turns out the cause of my issue was another rex statement down the line that hadn't been updated to match the renamed string. It used&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;(?&amp;lt;Foo&amp;gt;\D\d*)-0&lt;/LI-CODE&gt;
&lt;P&gt;which matched the string before the replacement, which the statement is now&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;(?&amp;lt;Foo&amp;gt;\D*\d)-0&lt;/LI-CODE&gt;
&lt;P&gt;Apologies for my confusion. I've marked your efforts as the solution as the backslash was indeed not needed.&lt;/P&gt;
&lt;P&gt;Thank you and have some Karma for your efforts.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 19:11:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Issue-using-rex-to-replace-string/m-p/681613#M232921</guid>
      <dc:creator>Scharf</dc:creator>
      <dc:date>2024-03-21T19:11:44Z</dc:date>
    </item>
  </channel>
</rss>

