<?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: Splunk Regex Question in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748040#M22402</link>
    <description>&lt;P class="lia-align-left"&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-left"&gt;Rule looking up process info in general:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;| tstats `content_summariesonly` values(Processes.process_id) as process_id, values(Processes.parent_process_id) as parent_process_id values(Processes.process) as process min(_time) as firstTime max(_time) as lastTime from datamodel=Endpoint.Processes where `process_powershell` (Processes.process="* -ex*" AND Processes.process="* bypass *") by Processes.action Processes.dest Processes.original_file_name Processes.parent_process Processes.parent_process_exec Processes.parent_process_guid Processes.parent_process_id Processes.parent_process_name Processes.parent_process_path Processes.process Processes.process_exec Processes.process_guid Processes.process_hash Processes.process_id Processes.process_integrity_level Processes.process_name Processes.process_path Processes.user Processes.user_id Processes.vendor_product&lt;BR /&gt;| `drop_dm_object_name(Processes)`&lt;BR /&gt;| `security_content_ctime(firstTime)`&lt;BR /&gt;| `security_content_ctime(lastTime)`&lt;BR /&gt;| 'exceptions`&lt;BR /&gt;| stats values(dest) count by process, parent_process&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Macro (exceptions):&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;search process != "blah"&lt;BR /&gt;| regex process !="^C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" "Resolve-DnsName \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b \| Select-Object -Property NameHost$"&lt;/P&gt;</description>
    <pubDate>Mon, 16 Jun 2025 20:46:37 GMT</pubDate>
    <dc:creator>Bhart1</dc:creator>
    <dc:date>2025-06-16T20:46:37Z</dc:date>
    <item>
      <title>Splunk Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748028#M22397</link>
      <description>&lt;P&gt;I have a question regarding how to handle a regex query in a macro. Below I have a regex similar to the one I'm doing that matches when i use a regex checker, but when I try and add it to a simple search macro in splunk it gives an error:&lt;BR /&gt;&lt;BR /&gt;Error:&lt;BR /&gt;Error in 'SearchOperator:regex': Usage: regex &amp;lt;field&amp;gt; (=|!=) &amp;lt;regex&amp;gt;.&lt;BR /&gt;&lt;BR /&gt;Macro tied to the rule. Basically has a first part of a script, then IP address it ignores, and then a second part of the script. One below is really simplified but gets same error:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Regex Example:&lt;BR /&gt;| regex [field] !="^C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" "Resolve-DnsName \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b \| Select-Object -Property NameHost$"&lt;BR /&gt;&lt;BR /&gt;String to check against in this example:&amp;nbsp;&lt;BR /&gt;C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" "Resolve-DnsName 0.0.0.0 | Select-Object -Property NameHost&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I feel like this should work, but maybe there is something I'm missing on how Splunk handles regex and how I need to tweak it.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Any info on this would be greatly appreciated.&amp;nbsp;&lt;BR /&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2025 18:32:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748028#M22397</guid>
      <dc:creator>Bhart1</dc:creator>
      <dc:date>2025-06-16T18:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748034#M22398</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;[field]&lt;/FONT&gt; is improper syntax for the regex command.&amp;nbsp; Use the field name by itself.&amp;nbsp; If it's an argument to a macro then use &lt;FONT face="courier new,courier"&gt;$field$&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2025 19:36:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748034#M22398</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2025-06-16T19:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748036#M22399</link>
      <description>&lt;P&gt;Oh apologies for the misunderstanding. That's not how it really is. I just have that as a placeholder for the real field.&lt;BR /&gt;&lt;BR /&gt;It's like this:&lt;BR /&gt;&lt;BR /&gt;| regex fieldname !=&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2025 19:59:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748036#M22399</guid>
      <dc:creator>Bhart1</dc:creator>
      <dc:date>2025-06-16T19:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748037#M22400</link>
      <description>&lt;P&gt;Please put the *real* and *complete* macro definition in a code block so we know exactly what we're working with and can test it in our own sandboxes.&amp;nbsp; Please also include how the macro is used in a query.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2025 20:14:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748037#M22400</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2025-06-16T20:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748040#M22402</link>
      <description>&lt;P class="lia-align-left"&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-left"&gt;Rule looking up process info in general:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;| tstats `content_summariesonly` values(Processes.process_id) as process_id, values(Processes.parent_process_id) as parent_process_id values(Processes.process) as process min(_time) as firstTime max(_time) as lastTime from datamodel=Endpoint.Processes where `process_powershell` (Processes.process="* -ex*" AND Processes.process="* bypass *") by Processes.action Processes.dest Processes.original_file_name Processes.parent_process Processes.parent_process_exec Processes.parent_process_guid Processes.parent_process_id Processes.parent_process_name Processes.parent_process_path Processes.process Processes.process_exec Processes.process_guid Processes.process_hash Processes.process_id Processes.process_integrity_level Processes.process_name Processes.process_path Processes.user Processes.user_id Processes.vendor_product&lt;BR /&gt;| `drop_dm_object_name(Processes)`&lt;BR /&gt;| `security_content_ctime(firstTime)`&lt;BR /&gt;| `security_content_ctime(lastTime)`&lt;BR /&gt;| 'exceptions`&lt;BR /&gt;| stats values(dest) count by process, parent_process&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Macro (exceptions):&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;search process != "blah"&lt;BR /&gt;| regex process !="^C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" "Resolve-DnsName \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b \| Select-Object -Property NameHost$"&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2025 20:46:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748040#M22402</guid>
      <dc:creator>Bhart1</dc:creator>
      <dc:date>2025-06-16T20:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748046#M22405</link>
      <description>&lt;P&gt;Ok. Firstly, it's bad syntax. The syntax (in your case) should be&lt;/P&gt;&lt;PRE&gt;| regex field!="regex"&lt;/PRE&gt;&lt;P&gt;while you have&lt;/P&gt;&lt;PRE&gt;| regex field!="regex" "something else"&lt;/PRE&gt;&lt;P&gt;And secondly, the regex provided as a string is subject to the normal string escaping rules. So your "\\W" becomes efectively a regex for \W, which means "any non-word character" and so on. You should also escape the backslashes for the actual regex classes. So instead of "\d" you should use "\\d" and so on.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2025 21:29:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748046#M22405</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2025-06-16T21:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748049#M22406</link>
      <description>&lt;P&gt;So is there no way to have it match the first and last strings while excluding a certain middle part? Something like:&lt;BR /&gt;&lt;BR /&gt;"[string1, regex to exclude middle part, string2]"&lt;BR /&gt;&lt;BR /&gt;I mean it's pretty clear with the matching string and regex that the point is to match everything but the changing IP.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" "Resolve-DnsName 0.0.0.0 | Select-Object -Property NameHost&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2025 21:49:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748049#M22406</guid>
      <dc:creator>Bhart1</dc:creator>
      <dc:date>2025-06-16T21:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748058#M22408</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/275048"&gt;@Bhart1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;So is there no way to have it match the first and last strings while excluding a certain middle part? Something like:&lt;BR /&gt;&lt;BR /&gt;"[string1, regex to exclude middle part, string2]"&lt;BR /&gt;&lt;BR /&gt;I mean it's pretty clear with the matching string and regex that the point is to match everything but the changing IP.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" "Resolve-DnsName 0.0.0.0 | Select-Object -Property NameHost&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;You can do that, and it's done all the time.&amp;nbsp; However, the regular expression MUST be a single quoted string.&amp;nbsp; Something like this.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| regex process !="^C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe Resolve-DnsName \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b \| Select-Object -Property NameHost$"&lt;/LI-CODE&gt;&lt;P&gt;I disagree with&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;about the escaping.&amp;nbsp; I think you have that part right.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2025 00:07:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748058#M22408</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2025-06-17T00:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Regex Question</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748067#M22409</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;I disagree with your disagreeing &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;| makeresults&lt;BR /&gt;| eval s="c:\\windows"&lt;BR /&gt;| regex s="c:\\\\windows"&lt;/PRE&gt;&lt;P&gt;This one returns a result while this one&lt;/P&gt;&lt;PRE&gt;| makeresults&lt;BR /&gt;| eval s="c:\\windows"&lt;BR /&gt;| regex s="c:\\windows"&lt;/PRE&gt;&lt;P&gt;doesn't.&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/275048"&gt;@Bhart1&lt;/a&gt;&amp;nbsp;I'm not sure what you mean by "exclude" here. In any case you just need a single regex to match. If you wan to match anything having parts matching both regexes, you might simply join them with a "match anything" .*. Like&lt;/P&gt;&lt;PRE&gt;|regex field!="C:\\\\WINDOWS\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe.*Resolve-DnsName \\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3} \\| Select-Object -Property NameHost"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2025 05:32:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Splunk-Regex-Question/m-p/748067#M22409</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2025-06-17T05:32:03Z</dc:date>
    </item>
  </channel>
</rss>

