<?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: How to rex using sed rex command? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-rex-using-sed-rex-command/m-p/307472#M92242</link>
    <description>&lt;P&gt;Most likely you have a problem with the regular expression.&lt;/P&gt;

&lt;P&gt;What are the actual values of XXXX (letters, numbers)?&lt;/P&gt;

&lt;P&gt;The regular expression you have is looking for 1 or more digits followed by 0 or more letters or numbers and replacing the matches with XXXX&lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/"&gt;regex101.com&lt;/A&gt; is a good online regex utility to help build regular expressions&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jan 2018 12:54:34 GMT</pubDate>
    <dc:creator>brettcarroll</dc:creator>
    <dc:date>2018-01-16T12:54:34Z</dc:date>
    <item>
      <title>How to rex using sed rex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rex-using-sed-rex-command/m-p/307471#M92241</link>
      <description>&lt;P&gt;How to rex using sed rex command?&lt;/P&gt;

&lt;P&gt;index = main &lt;BR /&gt;
| rex field=URI "^(?.+?)(\?|\z)" &lt;BR /&gt;
 |rex field=New_APIName mode=sed "s/\d+[a-zA-Z0-9*]/XXXX/g"&lt;BR /&gt;
| stats count by New_APIName&lt;/P&gt;

&lt;P&gt;I am getting output as &lt;/P&gt;

&lt;P&gt;/v1/cp/members/XXXX/benefits/XXXXBG-XXXX-XXXX/benefitlist&lt;BR /&gt;&lt;BR /&gt;
/v1/cp/members/XXXX/benefits/XXXXBG-XXXX-XXXX-/excluded&lt;BR /&gt;&lt;BR /&gt;
/v1/cp/members/XXXX/benefits/XXXXUF-XXXX-XXXX-/benefitlist&lt;BR /&gt;&lt;BR /&gt;
/v1/cp/members/XXXX/benefits/XXXXUF-XXXX-XXXX-/excluded&lt;BR /&gt;&lt;BR /&gt;
/v1/cp/members/XXXX/benefits/XXXXUU-XXXX-XXXX-/benefitlist&lt;BR /&gt;&lt;BR /&gt;
/v1/cp/members/XXXX/benefits/XXXXUU-XXXX-XXXX-/excluded&lt;BR /&gt;&lt;BR /&gt;
/v1/cp/members/XXXX/benefits/XXXXXXXX-XXXX-XXXX-/benefitlist&lt;BR /&gt;&lt;BR /&gt;
/v1/cp/members/XXXX/benefits/XXXXXXXX-XXXX-XXXX-/excluded  &lt;/P&gt;

&lt;P&gt;Expected result:&lt;/P&gt;

&lt;P&gt;/v1/cp/members/XXXX/benefits/XXXX/benefitlist&lt;BR /&gt;&lt;BR /&gt;
/v1/cp/members/XXXX/benefits/XXXX/excluded    &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:39:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rex-using-sed-rex-command/m-p/307471#M92241</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2020-09-29T17:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to rex using sed rex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rex-using-sed-rex-command/m-p/307472#M92242</link>
      <description>&lt;P&gt;Most likely you have a problem with the regular expression.&lt;/P&gt;

&lt;P&gt;What are the actual values of XXXX (letters, numbers)?&lt;/P&gt;

&lt;P&gt;The regular expression you have is looking for 1 or more digits followed by 0 or more letters or numbers and replacing the matches with XXXX&lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/"&gt;regex101.com&lt;/A&gt; is a good online regex utility to help build regular expressions&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 12:54:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rex-using-sed-rex-command/m-p/307472#M92242</guid>
      <dc:creator>brettcarroll</dc:creator>
      <dc:date>2018-01-16T12:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to rex using sed rex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rex-using-sed-rex-command/m-p/307473#M92243</link>
      <description>&lt;P&gt;Hi @karthi2809&lt;BR /&gt;
Try below regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;base search&amp;gt; | rex mode=sed field=New_APIName "s/(^\/\w+\/\w+\/\w+\/\w+\/\w+\/.{4})[^\/]+(\/\w+)/\1\2/"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jan 2018 13:22:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rex-using-sed-rex-command/m-p/307473#M92243</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-01-16T13:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to rex using sed rex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-rex-using-sed-rex-command/m-p/307474#M92244</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;try this one&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| rex mode=sed field=&amp;lt;yourfield&amp;gt; "s/^(\/[^\/]*\/[^\/]*\/[^\/]*\/[^\/]*\/[^\/]*\/)[^\/]*(\/[^\/]*)/\1XXXX\2/g"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/rwjLxP/1"&gt;https://regex101.com/r/rwjLxP/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 13:31:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-rex-using-sed-rex-command/m-p/307474#M92244</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2018-01-16T13:31:22Z</dc:date>
    </item>
  </channel>
</rss>

