<?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: Regex AND Operator in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305736#M91794</link>
    <description>&lt;P&gt;Can you provide sample events and tell what do you want to extract it?&lt;BR /&gt;
Also put the code in &lt;CODE&gt;10101&lt;/CODE&gt; sample code format. &lt;/P&gt;</description>
    <pubDate>Fri, 23 Feb 2018 03:13:42 GMT</pubDate>
    <dc:creator>mayurr98</dc:creator>
    <dc:date>2018-02-23T03:13:42Z</dc:date>
    <item>
      <title>Regex AND Operator</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305735#M91793</link>
      <description>&lt;P&gt;I thought &lt;CODE&gt;?=&lt;/CODE&gt; acts like an AND operator.  &lt;/P&gt;

&lt;P&gt;Condition would be to capture words with &amp;gt;5 Upper-Case AND 4 Lower-Case and any other non-whitespace in the word.&lt;/P&gt;

&lt;P&gt;Here's what i came up with - doesn't seem to work: &lt;BR /&gt;
    "s/(\S*[A-Z]{5,})(?=[a-z]{4,})\S*//g"&lt;/P&gt;

&lt;P&gt;Would want it to capture strings like these:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;adsdkdkDKDKDdkd:djkDKDK &lt;/LI&gt;
&lt;LI&gt;ASaFaAdfkK-asdfoiA &lt;/LI&gt;
&lt;LI&gt;asdfASDFF&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;I realized this actually works but doesn't work on words with non-consecutive A-Z. Any idea how to make it work with non-consecutive A-Z?&lt;/P&gt;

&lt;P&gt;TEST1 doesn't work (non-consecutive): &lt;BR /&gt;
| makeresults | eval TEST="AAAaAAaaaassdjkd" | rex field=TEST max_match=0 "(?\S*([A-Z]{5,})(?=[a-z]{4,})\S*)"&lt;/P&gt;

&lt;P&gt;TEST1 Does work (consecutive AAAAAaaaa)&lt;BR /&gt;
| makeresults | eval TEST="AAAAAaaaassdjkd" | rex field=TEST max_match=0 "(?\S*([A-Z]{5,})(?=[a-z]{4,})\S*)"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:10:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305735#M91793</guid>
      <dc:creator>subtrakt</dc:creator>
      <dc:date>2020-09-29T18:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Regex AND Operator</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305736#M91794</link>
      <description>&lt;P&gt;Can you provide sample events and tell what do you want to extract it?&lt;BR /&gt;
Also put the code in &lt;CODE&gt;10101&lt;/CODE&gt; sample code format. &lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 03:13:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305736#M91794</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-02-23T03:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Regex AND Operator</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305737#M91795</link>
      <description>&lt;P&gt;can you please provide the sample output too ? I couldn't get the &amp;gt;5 part&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 05:52:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305737#M91795</guid>
      <dc:creator>ibob0304</dc:creator>
      <dc:date>2018-02-23T05:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Regex AND Operator</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305738#M91796</link>
      <description>&lt;P&gt;"s/(\S*[A-Z]{5,})(?=[a-z]{4,})\S*//g"&lt;/P&gt;

&lt;P&gt;I realized this actually works but doesn't work on words with non-consecutive A-Z.  Any idea how to make it work with non-consecutive A-Z?&lt;/P&gt;

&lt;P&gt;This would work AAAAAaaaassdjkd &lt;BR /&gt;
This would not work AAaaAAaaaaasfd&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:10:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305738#M91796</guid>
      <dc:creator>subtrakt</dc:creator>
      <dc:date>2020-09-29T18:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Regex AND Operator</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305739#M91797</link>
      <description>&lt;P&gt;TEST1 doesn't work (non-consecutive): &lt;BR /&gt;
| makeresults | eval TEST="AAAaAAaaaassdjkd" | rex field=TEST max_match=0 "(?\S*([A-Z]{5,})(?=[a-z]{4,})\S*)" &lt;/P&gt;

&lt;P&gt;TEST1 Does work (consecutive)&lt;BR /&gt;
| makeresults | eval TEST="AAAAAaaaassdjkd" | rex field=TEST max_match=0 "(?\S*([A-Z]{5,})(?=[a-z]{4,})\S*)"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:10:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305739#M91797</guid>
      <dc:creator>subtrakt</dc:creator>
      <dc:date>2020-09-29T18:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Regex AND Operator</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305740#M91798</link>
      <description>&lt;P&gt;Using the positive lookahead approach, &lt;CODE&gt;((?=(?:\S*[A-Z]){5,})(?:\S*[a-z]){4,}\S*)&lt;/CODE&gt; will match both cases. The match itself says "any non-space followed by a lower-case letter, at least four times - followed by any non-space" while the positive lookahead first asserts "any non-space followed by an upper-case letter, at least five times", no need to assert the followed-by part here.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2018 00:37:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305740#M91798</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2018-02-25T00:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Regex AND Operator</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305741#M91799</link>
      <description>&lt;P&gt;Thanks Martin - &lt;/P&gt;

&lt;P&gt;Came up with this  solution as well but yours looks cleaner.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval TEST="AAAaaAaaaa" | rex field=TEST max_match=0 "(?&amp;lt;TEST1&amp;gt;\S*(?=([a-z]*[A-Z]){4})(?=([A-Z]*[a-z]){6})[a-zA-Z]*\S*)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Feb 2018 15:42:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305741#M91799</guid>
      <dc:creator>subtrakt</dc:creator>
      <dc:date>2018-02-26T15:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Regex AND Operator</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305742#M91800</link>
      <description>&lt;P&gt;One question regarding your non-capture groups.  Are those for efficiency?  I realized i can take out the ?: and it still works.   &lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2018 15:48:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-AND-Operator/m-p/305742#M91800</guid>
      <dc:creator>subtrakt</dc:creator>
      <dc:date>2018-02-26T15:48:00Z</dc:date>
    </item>
  </channel>
</rss>

