<?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: Search Using Regular Expression is Case-Sensitive in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399098#M115703</link>
    <description>&lt;P&gt;Replace the two where statements with a subsearch.&lt;/P&gt;

&lt;P&gt;| search New_Process_Name="C:\Windows\System32\mmc.exe" AND Login_Security_ID = &lt;EM&gt;username&lt;/EM&gt; &lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 20:50:44 GMT</pubDate>
    <dc:creator>anthonymelita</dc:creator>
    <dc:date>2020-09-29T20:50:44Z</dc:date>
    <item>
      <title>Search Using Regular Expression is Case-Sensitive</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399097#M115702</link>
      <description>&lt;P&gt;I'm using a regular expression to locate a certain field in a particular event and then return results where the contents of that field are "like" a certain string. However, what I'm finding is that the "like" operator is matching based on case. Similarly, when I switch the query to match the string exactly (i.e., using "="), this too is case-sensitive. &lt;/P&gt;

&lt;P&gt;The example below returns the desired result. However, if I make the following change, no result is returned: &lt;/P&gt;

&lt;P&gt;where (like (Login_Security_ID,"%&lt;STRONG&gt;UserName&lt;/STRONG&gt;%")) &lt;BR /&gt;
&lt;EM&gt;--to--&lt;/EM&gt;&lt;BR /&gt;
where (like (Login_Security_ID,"%&lt;STRONG&gt;username&lt;/STRONG&gt;%"))&lt;/P&gt;

&lt;P&gt;Any idea on how I can make this case INsensitive? Thanks for the help.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Search Being Run&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EventCode=4688
| rex "(?ms)Security ID:..(?&amp;lt;Login_Security_ID&amp;gt;[DOMAIN]+.\w+.\w+)"
| rex "(?ms)New Process Name:..(?&amp;lt;New_Process_Name&amp;gt;.\S*)"
| where New_Process_Name=":\Windows\System32\mmc.exe"
| where (like (Login_Security_ID,"%UserName%")) 
| eval attemptoutcome = keywords
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Event Attempting to Return&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;08/10/2018 10:37:47 AM
LogName=Security
SourceName=Microsoft Windows security auditing.
EventCode=4688
EventType=0
Type=Information
ComputerName=server.DOMAIN.com
TaskCategory=Process Creation
OpCode=Info
RecordNumber=6646657
Keywords=Audit Success
Message=A new process has been created.

Subject:
    Security ID:        DOMAIN\srvcUserName
    Account Name:       srvcUserName
    Account Domain:     DOMAIN
    Logon ID:       0xd3245f55

Process Information:
    New Process ID:     0x9b4
    New Process Name:   C:\Windows\System32\mmc.exe
    Token Elevation Type:   TokenElevationTypeLimited (3)
    Creator Process ID: 0xf48
    Process Command Line:
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:50:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399097#M115702</guid>
      <dc:creator>adamfiore</dc:creator>
      <dc:date>2020-09-29T20:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Search Using Regular Expression is Case-Sensitive</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399098#M115703</link>
      <description>&lt;P&gt;Replace the two where statements with a subsearch.&lt;/P&gt;

&lt;P&gt;| search New_Process_Name="C:\Windows\System32\mmc.exe" AND Login_Security_ID = &lt;EM&gt;username&lt;/EM&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:50:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399098#M115703</guid>
      <dc:creator>anthonymelita</dc:creator>
      <dc:date>2020-09-29T20:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: Search Using Regular Expression is Case-Sensitive</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399099#M115704</link>
      <description>&lt;P&gt;@adamfiore, for case insensitive match please use &lt;CODE&gt;match()&lt;/CODE&gt; function with &lt;CODE&gt;(?i)&lt;/CODE&gt; parameter:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where match(New_Process_Name,"(?i)\\\windows\\\system32\\\mmc.exe") AND match(Login_Security_ID,"(?i)username")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is a run anywhere example based on your sample data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw=" 08/10/2018 10:37:47 AM
 LogName=Security
 SourceName=Microsoft Windows security auditing.
 EventCode=4688
 EventType=0
 Type=Information
 ComputerName=server.DOMAIN.com
 TaskCategory=Process Creation
 OpCode=Info
 RecordNumber=6646657
 Keywords=Audit Success
 Message=A new process has been created.

 Subject:
     Security ID:        DOMAIN\srvcUserName
     Account Name:        srvcUserName
     Account Domain:        DOMAIN
     Logon ID:        0xd3245f55

 Process Information:
     New Process ID:        0x9b4
     New Process Name:    C:\Windows\System32\mmc.exe
     Token Elevation Type:    TokenElevationTypeLimited (3)
     Creator Process ID:    0xf48
     Process Command Line:" 
| rex "Security ID:\s+(?&amp;lt;Login_Security_ID&amp;gt;[^\s]+)\s"
| rex "New Process Name:\s+(?&amp;lt;New_Process_Name&amp;gt;[^\s]+)\s"
| where match(New_Process_Name,"(?i)\\\windows\\\system32\\\mmc.exe") AND match(Login_Security_ID,"(?i)username")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Aug 2018 17:25:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399099#M115704</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-08-10T17:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Search Using Regular Expression is Case-Sensitive</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399100#M115705</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/44217"&gt;@anthonymelita&lt;/a&gt; Thanks for the reply, but I'm afraid this didn't work. In fact, I couldn't get the sub-search to work even when I matched the case of the username in the search query exactly as it's showing up in the event, as seen below:&lt;/P&gt;

&lt;P&gt;| search New_Process_Name="C:\Windows\System32\mmc.exe" AND Login_Security_ID = DOMAIN\srvcUserName&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:51:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399100#M115705</guid>
      <dc:creator>adamfiore</dc:creator>
      <dc:date>2020-09-29T20:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Search Using Regular Expression is Case-Sensitive</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399101#M115706</link>
      <description>&lt;P&gt;@ niketnilay Thanks for the reply. Same as above though, this didn't work for me. I also tried using (?i) with the like function, as well as matching the case of the username exactly as it's appearing in the event, but even that failed to return a result. Here are a few of the variations I tried:&lt;/P&gt;

&lt;P&gt;| where match (Login_Security_ID,"(?i)domain\srvcusername")&lt;BR /&gt;
| where match (Login_Security_ID,"(?i)DOMAIN\srvcUserName")&lt;BR /&gt;
| where like (Login_Security_ID,"(?i)domain\srvcusername")&lt;BR /&gt;
| where match (Login_Security_ID,"(?i)DOMAIN\srvcUserName")&lt;BR /&gt;
| where like (Login_Security_ID,"(?i)%username")&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:51:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399101#M115706</guid>
      <dc:creator>adamfiore</dc:creator>
      <dc:date>2020-09-29T20:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Search Using Regular Expression is Case-Sensitive</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399102#M115707</link>
      <description>&lt;P&gt;Hello, I think you need to escape that backslash as follows:&lt;BR /&gt;
     where match (Login_Security_ID,"(?i)DOMAIN\\srvcUserName")&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:51:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399102#M115707</guid>
      <dc:creator>chanfoli</dc:creator>
      <dc:date>2020-09-29T20:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Search Using Regular Expression is Case-Sensitive</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399103#M115708</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/119596"&gt;@chanfoli&lt;/a&gt;, that worked. Assuming I can't use the "%" wildcard with "match", like this:&lt;/P&gt;

&lt;P&gt;| where match (Login_Security_ID,"(?i)%srvcusername")&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:51:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399103#M115708</guid>
      <dc:creator>adamfiore</dc:creator>
      <dc:date>2020-09-29T20:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Search Using Regular Expression is Case-Sensitive</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399104#M115709</link>
      <description>&lt;P&gt;@adamfiore two things need to be changed... &lt;/P&gt;

&lt;P&gt;1) use &lt;CODE&gt;\\&lt;/CODE&gt; to escape each &lt;CODE&gt;\&lt;/CODE&gt; in the path as stated in my answer.&lt;BR /&gt;
2) Use &lt;CODE&gt;AND&lt;/CODE&gt; to join multiple match conditions together as stated in my answer instead of using separate pipes.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Aug 2018 15:41:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-Using-Regular-Expression-is-Case-Sensitive/m-p/399104#M115709</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-08-14T15:41:35Z</dc:date>
    </item>
  </channel>
</rss>

