<?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 extract a filepath after certain folders using regex? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656840#M54107</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/30057"&gt;@anooshac&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;wher there are more backslashes there is an issue, so please try:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=your_field "^\w:\\\\w+\\\\w+\\\\w+\\\\w+(?&amp;lt;filename&amp;gt;.*)"&lt;/LI-CODE&gt;&lt;P&gt;ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 06 Sep 2023 14:16:16 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-09-06T14:16:16Z</dc:date>
    <item>
      <title>How to extract a filepath after certain folders using regex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656794#M54097</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;I have to extract a file path from a path.&lt;/P&gt;&lt;P&gt;The path will be in the format C:\a\b\c\abc\xyz\abc.h.&lt;/P&gt;&lt;P&gt;I want to skip first 4 folders. That is in this example i want to extract \abc\xyz\abc.h.&lt;/P&gt;&lt;P&gt;How can i dot it using regex?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 09:55:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656794#M54097</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2023-09-06T09:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a filepath after certain folders using regex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656795#M54098</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/30057"&gt;@anooshac&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I suppose that you have this path in a field, so you could use something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=your_field "^(?&amp;lt;path&amp;gt;\w:\\\w+\\\w+\\\w+\\\w+)"&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/kpyTLl/1" target="_blank"&gt;https://regex101.com/r/kpyTLl/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It could be possible that there's an issue for a difference between regex101.com and Splunk, so, if the above regex doesn't run, please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=your_field "^(?&amp;lt;path&amp;gt;\w:\\\\w+\\\\w+\\\\w+\\\\w+)"&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 10:08:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656795#M54098</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-06T10:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a filepath after certain folders using regex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656828#M54104</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt; , Thanks for the response..&lt;/P&gt;&lt;P&gt;I don't want to&amp;nbsp; extract the first 4 folders.. I want to skip them and extract the rest of the path.. I was finding hard writing a regex.. How can i do this?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 13:03:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656828#M54104</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2023-09-06T13:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a filepath after certain folders using regex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656829#M54105</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/30057"&gt;@anooshac&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;it's the same thing:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=your_field "^\w:\\\w+\\\w+\\\w+\\\w+(?&amp;lt;filename&amp;gt;.*)"&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 13:12:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656829#M54105</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-06T13:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a filepath after certain folders using regex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656834#M54106</link>
      <description>&lt;P&gt;hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;I am not able to get the path \xyz\abc.h using this regex..&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 13:51:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656834#M54106</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2023-09-06T13:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a filepath after certain folders using regex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656840#M54107</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/30057"&gt;@anooshac&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;wher there are more backslashes there is an issue, so please try:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=your_field "^\w:\\\\w+\\\\w+\\\\w+\\\\w+(?&amp;lt;filename&amp;gt;.*)"&lt;/LI-CODE&gt;&lt;P&gt;ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 14:16:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656840#M54107</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-06T14:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a filepath after certain folders using regex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656848#M54108</link>
      <description>&lt;P&gt;hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt; , still i am not able to extract.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 14:41:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656848#M54108</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2023-09-06T14:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a filepath after certain folders using regex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656851#M54109</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/30057"&gt;@anooshac&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;the second regex is correct, as you can check at&amp;nbsp;&lt;A href="https://regex101.com/r/kpyTLl/2" target="_blank"&gt;https://regex101.com/r/kpyTLl/2,&lt;/A&gt;&lt;/P&gt;&lt;P&gt;in Splunk is different when you have backslashes, so you can try:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=your_field "^\w*:\\\\\w*\\\\\w*\\\\\w*\\\\\w*\\\\(?&amp;lt;filename&amp;gt;.*)"&lt;/LI-CODE&gt;&lt;P&gt;as you can check using the following search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval my_field="C:\a\b\c\abc\xyz\abc.h"
| rex field=my_field "^\w*:\\\\\w*\\\\\w*\\\\\w*\\\\\w*\\\\(?&amp;lt;filename&amp;gt;.*)"&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 14:53:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656851#M54109</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-06T14:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a filepath after certain folders using regex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656908#M54112</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;I tested it and it is working fine. The paths in my data are vary from another. I may have data something like this. In these conditions will it work.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;C:\a\b\c\abc.pqr.a1.b1.jkl\xyz\abc.h&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 04:43:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656908#M54112</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2023-09-07T04:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a filepath after certain folders using regex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656917#M54113</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/30057"&gt;@anooshac&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me understand, you could have different log formats: "&lt;SPAN&gt;C:\a\b\c\abc\xyz\abc.h" or ""C:\a\b\c\abc.pqr.a1.b1.jkl\xyz\abc.h", is it correct?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;in this case, you could try:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=your_field "^\w*:\\\\[^\\\]*\\\\\w*\\\\[^\\\]*\\\\[^\\\]*\\\\(?&amp;lt;filename&amp;gt;.*)"&lt;/LI-CODE&gt;&lt;P&gt;that you can try using this search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval your_field="C:\a\b\c\abc\xyz\abc.h"
| append [ | makeresults | eval your_field="C:\a\b\c\abc.pqr.a1.b1.jkl\xyz\abc.h" ]
| rex field=your_field "^\w*:\\\\[^\\\]*\\\\\w*\\\\[^\\\]*\\\\[^\\\]*\\\\(?&amp;lt;filename&amp;gt;.*)"&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 06:41:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656917#M54113</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-09-07T06:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a filepath after certain folders using regex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656938#M54118</link>
      <description>&lt;P&gt;OK. Assuming that:&lt;/P&gt;&lt;P&gt;1. You always have a drive letter at the beginning&lt;/P&gt;&lt;P&gt;2. You don't have "empty parts" (you don't have consecutive backslashes which are syntactically correct if you want to specify a file path but are typically not returned as a path to existing file)&lt;/P&gt;&lt;P&gt;3. You want to extract the part after the first four components&lt;/P&gt;&lt;P&gt;The regex to do so would be like that:&lt;/P&gt;&lt;PRE&gt;[a-zA-Z]:\\\\([^\\]+\\){4}(?&amp;lt;remainder&amp;gt;.*)&lt;/PRE&gt;&lt;P&gt;The "remainder" capture group will capture the path after first four directories.&lt;/P&gt;&lt;P&gt;Of course if you want to do it with "rex" command in Splunk, you need to escape all backslashes which makes it something like this:&lt;/P&gt;&lt;PRE&gt;| rex&amp;nbsp; "[a-zA-Z]:\\\\\\\\([^\\\\]+\\\\){4}(?&amp;lt;remainder&amp;gt;.*)"&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Sep 2023 09:05:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-a-filepath-after-certain-folders-using-regex/m-p/656938#M54118</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-09-07T09:05:08Z</dc:date>
    </item>
  </channel>
</rss>

