<?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: Does Splunk support regex support with look behind and look ahead? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308444#M92522</link>
    <description>&lt;P&gt;I did a bit more filtering so I am only returning events that have the CN=. I am not getting any results on the left and using the table FirstName , Last Name I am not getting any results. Is this because im running an older version of Splunk?(6.6.2)   &lt;/P&gt;</description>
    <pubDate>Thu, 22 Feb 2018 16:49:41 GMT</pubDate>
    <dc:creator>santorof</dc:creator>
    <dc:date>2018-02-22T16:49:41Z</dc:date>
    <item>
      <title>Does Splunk support regex support with look behind and look ahead?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308438#M92516</link>
      <description>&lt;P&gt;Does Splunk support regex look behind and look ahead? Specifically, I have a log that has the following: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;CN=LastName\, FirstName&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I am trying to use look behind to target anything before a comma after the first name and look ahead to target anything before CN= &lt;/P&gt;

&lt;P&gt;Not sure if it would be easier to separate what I am trying to capture into first name and last name where im capturing the first name anything after CN= and before the forward slash. For first name anything after forward slash comma and before another comma. &lt;/P&gt;

&lt;P&gt;This is the regex command I have currently: ( ? ! , ) * (? &amp;lt; ! CN=)&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 13:55:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308438#M92516</guid>
      <dc:creator>santorof</dc:creator>
      <dc:date>2018-02-22T13:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: Does Splunk support regex support with look behind and look ahead?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308439#M92517</link>
      <description>&lt;P&gt;Hi santorof,&lt;BR /&gt;
could you share an example of your log and what do you want to extract?&lt;BR /&gt;
(use the Code Sample button to display logs and regexes).&lt;/P&gt;

&lt;P&gt;Anyway, if your log is the one you showed ( &lt;CODE&gt;CN=LastName\, FirstName,&lt;/CODE&gt; ) and you want to extract two fields (Lastname and FirstName), you could try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "CN\=(?&amp;lt;LastName&amp;gt;[^\\]*)\\,\s(?&amp;lt;FirstName&amp;gt;[^,]*),"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can test at &lt;A href="https://regex101.com/r/5pWObU/1"&gt;https://regex101.com/r/5pWObU/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 14:12:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308439#M92517</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2018-02-22T14:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Does Splunk support regex support with look behind and look ahead?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308440#M92518</link>
      <description>&lt;P&gt;Heres one of the logs I have from my multi factor authentication logs: &lt;/P&gt;

&lt;P&gt;2018-02-22T13:39:24.320950Z|i|1624|1996|pfsvc|Pfauth succeeded for user 'CN=Ziti\, Frank,CN=Users,DC=tort,DC=net' (distinguishedName format) from 255.255.255.255.  Call status: SUCCESS - "Signal Entered".&lt;/P&gt;

&lt;P&gt;Ziti is the last name and Frank is the first name. Those arent static and are different for each log. &lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 14:23:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308440#M92518</guid>
      <dc:creator>santorof</dc:creator>
      <dc:date>2018-02-22T14:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Does Splunk support regex support with look behind and look ahead?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308441#M92519</link>
      <description>&lt;P&gt;Hi santorof,&lt;BR /&gt;
try my regex and check if it covers all your logs.&lt;BR /&gt;
Otherwise we could check if it must be modified or maybe we could use more regexes collected with the coalesce function.&lt;/P&gt;

&lt;P&gt;Anyway, as you can see at &lt;A href="https://regex101.com/r/5pWObU/2"&gt;https://regex101.com/r/5pWObU/2&lt;/A&gt; also the new example you shared is correctly read from the regex.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 14:56:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308441#M92519</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2018-02-22T14:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Does Splunk support regex support with look behind and look ahead?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308442#M92520</link>
      <description>&lt;P&gt;Giuseppe, &lt;/P&gt;

&lt;P&gt;Thanks for the regex command. I piped it after my main search but not seeing the fields populate on the left hand side.  Should I be doing a table command of FirstName and LastName? &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;index=dual_factor_auth status=SUCCESS | rex "CN=(?[^\]&lt;EM&gt;)\,\s(?[^,]&lt;/EM&gt;)," | table FirstName , LastName &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:10:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308442#M92520</guid>
      <dc:creator>santorof</dc:creator>
      <dc:date>2020-09-29T18:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Does Splunk support regex support with look behind and look ahead?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308443#M92521</link>
      <description>&lt;P&gt;Hi santorof,&lt;BR /&gt;
please use Code Sample button otherwise I cannot read your code!&lt;BR /&gt;
anyway, the search will be&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dual_factor_auth status=SUCCESS 
| rex "CN\=(?&amp;lt;LastName&amp;gt;[^\\]*)\\,\s(?&amp;lt;FirstName&amp;gt;[^,]*)," 
| table FirstName , LastName 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you don't use a table command you'll have your two new fields in the fields related to your logs (left side of your screen).&lt;BR /&gt;
If you want to list them you must use table command&lt;BR /&gt;
If only few events have these fields, filter your logs to be sure that regex is correct.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 16:25:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308443#M92521</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2018-02-22T16:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Does Splunk support regex support with look behind and look ahead?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308444#M92522</link>
      <description>&lt;P&gt;I did a bit more filtering so I am only returning events that have the CN=. I am not getting any results on the left and using the table FirstName , Last Name I am not getting any results. Is this because im running an older version of Splunk?(6.6.2)   &lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 16:49:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308444#M92522</guid>
      <dc:creator>santorof</dc:creator>
      <dc:date>2018-02-22T16:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Does Splunk support regex support with look behind and look ahead?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308445#M92523</link>
      <description>&lt;P&gt;Splunk version it's Ok.&lt;BR /&gt;
see if in the selected events there are someone where there are "CN=Ziti\, Frank,"&lt;BR /&gt;
and for test put in your main search "Ziti", to check if the regex correctly works.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 16:59:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308445#M92523</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2018-02-22T16:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Does Splunk support regex support with look behind and look ahead?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308446#M92524</link>
      <description>&lt;P&gt;Got it to work. Thank you for the assistance! &lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 13:05:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-Splunk-support-regex-support-with-look-behind-and-look/m-p/308446#M92524</guid>
      <dc:creator>santorof</dc:creator>
      <dc:date>2018-02-23T13:05:59Z</dc:date>
    </item>
  </channel>
</rss>

