<?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 Regex for looking at executables in a specific folder in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-looking-at-executables-in-a-specific-folder/m-p/449570#M127296</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I am trying to create a search that will parse our endpoint logs for any executable that have been run from the Desktop or Downloads folders and any sub folders. Most searches I try return a large number of false positives (product names or folders have desktop or downloads in the name, but they aren't specifically in that folder. So to combat this I'm trying to rex the specific folder. Using the regex I have below on regex101 it works exactly how I expect. However in splunk I get, first a missing parenthesis error, and if I arbitrarily add another close parenthesis I get "look back is not a fixed length" error. Thoughts?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=endpointsource AND event_name=process_ran
| rex field=CommandLine "(?&amp;lt;=\\Desktop|Downloads\\)(?&amp;lt;EXE_RAN&amp;gt;.*\.exe)"
| table _time ComputerName TargetFileName EXE_RAN user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Example of it working on regex101: &lt;A href="https://regex101.com/r/24uxEB/1"&gt;https://regex101.com/r/24uxEB/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 13 Aug 2019 16:39:16 GMT</pubDate>
    <dc:creator>tbradsher86</dc:creator>
    <dc:date>2019-08-13T16:39:16Z</dc:date>
    <item>
      <title>Regex for looking at executables in a specific folder</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-looking-at-executables-in-a-specific-folder/m-p/449570#M127296</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I am trying to create a search that will parse our endpoint logs for any executable that have been run from the Desktop or Downloads folders and any sub folders. Most searches I try return a large number of false positives (product names or folders have desktop or downloads in the name, but they aren't specifically in that folder. So to combat this I'm trying to rex the specific folder. Using the regex I have below on regex101 it works exactly how I expect. However in splunk I get, first a missing parenthesis error, and if I arbitrarily add another close parenthesis I get "look back is not a fixed length" error. Thoughts?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=endpointsource AND event_name=process_ran
| rex field=CommandLine "(?&amp;lt;=\\Desktop|Downloads\\)(?&amp;lt;EXE_RAN&amp;gt;.*\.exe)"
| table _time ComputerName TargetFileName EXE_RAN user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Example of it working on regex101: &lt;A href="https://regex101.com/r/24uxEB/1"&gt;https://regex101.com/r/24uxEB/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 16:39:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-looking-at-executables-in-a-specific-folder/m-p/449570#M127296</guid>
      <dc:creator>tbradsher86</dc:creator>
      <dc:date>2019-08-13T16:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for looking at executables in a specific folder</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-looking-at-executables-in-a-specific-folder/m-p/449571#M127297</link>
      <description>&lt;P&gt;Here is one way:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=CommandLine ".*(Desktop|Downloads)\\\(?&amp;lt;EXE_RAN&amp;gt;.*\.exe)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/24uxEB/2"&gt;https://regex101.com/r/24uxEB/2&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 16:47:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-looking-at-executables-in-a-specific-folder/m-p/449571#M127297</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2019-08-13T16:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for looking at executables in a specific folder</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-looking-at-executables-in-a-specific-folder/m-p/449572#M127298</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=CommandLine "(?&amp;lt;=\\\Desktop|Downloads\\\)(?&amp;lt;EXE_RAN&amp;gt;.*\.exe)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also try run anywhere search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval data="C:\users\user1\Downloads\blah.exe,C:\Users\user234\Downloads\sqldeveloper-17.4.0.355.2349-x64\sqldeveloper\sqldeveloper\bin\sqldeveloper64W.exe,C:\Users\user9823\AppData\Local\iManage\Installer\Updates\iManage Work Desktop for Windows x86.exe,C:\Users\johnsmith\Desktop\dataloader-44.0.0.exe" 
| makemv data delim="," 
| mvexpand data 
| table data 
| rex field=data "(?&amp;lt;=\\\Desktop|Downloads\\\)(?&amp;lt;EXE_RAN&amp;gt;.*\.exe)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Aug 2019 16:51:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-looking-at-executables-in-a-specific-folder/m-p/449572#M127298</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-08-13T16:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for looking at executables in a specific folder</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-looking-at-executables-in-a-specific-folder/m-p/449573#M127299</link>
      <description>&lt;P&gt;This gets me the following error still:&lt;/P&gt;

&lt;P&gt;Error in 'rex' command: Encountered the following error while compiling the regex '.&lt;EM&gt;(Desktop|Downloads)(?.&lt;/EM&gt;.exe)': Regex: unmatched closing parenthesis.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 16:51:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-looking-at-executables-in-a-specific-folder/m-p/449573#M127299</guid>
      <dc:creator>tbradsher86</dc:creator>
      <dc:date>2019-08-13T16:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for looking at executables in a specific folder</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-looking-at-executables-in-a-specific-folder/m-p/449574#M127300</link>
      <description>&lt;P&gt;Sorry, forgot Splunk needed another escape character. Fixed above!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 16:55:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-looking-at-executables-in-a-specific-folder/m-p/449574#M127300</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2019-08-13T16:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for looking at executables in a specific folder</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-looking-at-executables-in-a-specific-folder/m-p/449575#M127301</link>
      <description>&lt;P&gt;This worked perfectly, that extra escape character really got me. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 11:47:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-looking-at-executables-in-a-specific-folder/m-p/449575#M127301</guid>
      <dc:creator>tbradsher86</dc:creator>
      <dc:date>2019-08-14T11:47:32Z</dc:date>
    </item>
  </channel>
</rss>

