<?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 validate regex expression? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296637#M89483</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;|rex mode=sed "s/^((\/\w+){2})(\/\D+).*?(\/\w+\/\D+).*?(\/\w+)/\1\3\4\5/g"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 29 Mar 2018 07:56:30 GMT</pubDate>
    <dc:creator>ips_mandar</dc:creator>
    <dc:date>2018-03-29T07:56:30Z</dc:date>
    <item>
      <title>How to validate regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296634#M89480</link>
      <description>&lt;P&gt;my regex:&lt;/P&gt;

&lt;P&gt;s/[^a-z]+\d/####/g&lt;/P&gt;

&lt;P&gt;Output:&lt;BR /&gt;
/v3/securemessages/members654fdfgd2-b2ad545a-b2f2-d545eb545d45/messages/incident4545/reply&lt;/P&gt;

&lt;P&gt;Expected output:&lt;/P&gt;

&lt;P&gt;/v3/securemessages/members/messages/incident/reply&lt;/P&gt;

&lt;P&gt;please help on this.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 06:25:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296634#M89480</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2018-03-29T06:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296635#M89481</link>
      <description>&lt;P&gt;try this,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.+((?i)members\/).+
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Mar 2018 06:37:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296635#M89481</guid>
      <dc:creator>splunker12er</dc:creator>
      <dc:date>2018-03-29T06:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296636#M89482</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
can you try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...|rex mode=sed "s/^((\/\w+){2})(\/\D+).*?(\/\w+\/\D+).*?(\/\w+)/\1\3\4\5/g"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Mar 2018 07:54:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296636#M89482</guid>
      <dc:creator>ips_mandar</dc:creator>
      <dc:date>2018-03-29T07:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296637#M89483</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;|rex mode=sed "s/^((\/\w+){2})(\/\D+).*?(\/\w+\/\D+).*?(\/\w+)/\1\3\4\5/g"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Mar 2018 07:56:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296637#M89483</guid>
      <dc:creator>ips_mandar</dc:creator>
      <dc:date>2018-03-29T07:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296638#M89484</link>
      <description>&lt;P&gt;@karthi2809, what exactly are you trying to achieve if I may ask?&lt;/P&gt;

&lt;P&gt;Do you simply want to get rid of the numbers and symbols from any directory level in your path?&lt;BR /&gt;
If so, what about v3, does that count too?&lt;/P&gt;

&lt;P&gt;See in any case my answer below in case it helps.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 08:02:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296638#M89484</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2018-03-29T08:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296639#M89485</link>
      <description>&lt;P&gt;As I mentioned above, try the following regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=yourfield mode=sed "s/(\/[A-Za-z][A-Za-z]+)([^\/]+)?/\1/g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For example, if I replicate your example in my lab:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval foo = "/v3/securemessages/members654fdfgd2-b2ad545a-b2f2-d545eb545d45/messages/incident4545/reply"
| rex field=foo mode=sed "s/(\/[A-Za-z][A-Za-z]+)([^\/]+)?/\1/g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Output:&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4643i1ED0B6CD9F310F0C/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Hope that helps.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
J&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 08:05:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296639#M89485</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2018-03-29T08:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296640#M89486</link>
      <description>&lt;P&gt;Thanks J &lt;BR /&gt;
When i used the regex i am getting output like this &lt;BR /&gt;
 /v3/securemessages/members/a#####aae#####b#####e-ae#####e#####aa#####f/categories&lt;/P&gt;

&lt;P&gt;Because I have lot URI in my event&lt;/P&gt;

&lt;P&gt;so i have query like this below:&lt;/P&gt;

&lt;P&gt;index=test_prod| rex field=URI "^(?.+?)(\?|\z)" &lt;BR /&gt;
| rex field=APIName mode=sed "s/[0-9A-F]{32}/#####/g" &lt;BR /&gt;
| rex field=APIName mode=sed "s/[0-9]{7}[\w]{2}[\d]{4}/#####/g"| rex field=APIName mode=sed "s/[^a-z]+\d/#####/g"| rex field=APIName mode=sed "s/[0-9]+\d/#####/g" |rex field=APIName mode=sed "s/(\/[A-Za-z][A-Za-z]+)([^\/]+)?/\1/g" &lt;BR /&gt;
| stats count by APIName Sender&lt;/P&gt;

&lt;P&gt;Can you please help on this&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 12:05:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296640#M89486</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2018-03-29T12:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296641#M89487</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;What do you want to see instead of &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/v3/securemessages/members/a#####aae#####b#####e-ae#####e#####aa#####f/categories
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;All the rex's you are running there in SED mode are basically replacing every match with 5 hashes so if you don't want to see that you can simply leave the second part of your SED pattern empty, as in:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=APIName mode=sed "s/[0-9A-F]{32}//g" 
| rex field=APIName mode=sed "s/[0-9]{7}[\w]{2}[\d]{4}//g"
| rex field=APIName mode=sed "s/[^a-z]+\d//g"
| rex field=APIName mode=sed "s/[0-9]+\d//g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it all looks over complicated to me so again, if you can provide a detailed sample, how it looks initially and your desired output, I might be able to help more.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 12:10:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296641#M89487</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2018-03-29T12:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate regex expression?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296642#M89488</link>
      <description>&lt;P&gt;Thanks a lot &lt;/P&gt;

&lt;P&gt;There is lot of URL i will send some complicated URI&lt;BR /&gt;
    /v1/utility/hcpcsprocedurecodes/j7q &lt;BR /&gt;
    /v1/utility/hcpcsprocedurecodes/m&lt;BR /&gt;&lt;BR /&gt;
    /v1/utility/hcpcsprocedurecodes/m7zv&lt;BR /&gt;&lt;BR /&gt;
    /v1/utility/hcpcsprocedurecodes/m7zz&lt;BR /&gt;&lt;BR /&gt;
         /v1/utility/revenuecodes/m &lt;BR /&gt;
    /v1/utility/revenuecodes/m7zv&lt;BR /&gt;
         /v3/securemessages/members/afae0-a4ecae9be1/categories &lt;BR /&gt;
    /v3/securemessages/members/afbfc-a7d3-f4afedf/categories&lt;BR /&gt;
/v3/securemessages/members/bda8eaaa-bdaf1e/messages/incident/reply&lt;/P&gt;

&lt;P&gt;Have to remove  ' bda8eaaa-bdaf1e','afbfc-a7d3-f4afedf'&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 13:48:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-validate-regex-expression/m-p/296642#M89488</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2018-03-29T13:48:44Z</dc:date>
    </item>
  </channel>
</rss>

