<?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 help in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462431#M130370</link>
    <description>&lt;PRE&gt;&lt;CODE&gt; index=main fail2ban.actions sshd
| rex "\[(?&amp;lt;jail&amp;gt;[a-z]+)\]"
| fields jail
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;regex: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Regex"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Regex&lt;/A&gt;&lt;BR /&gt;
rex: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;what do you want to do? &lt;BR /&gt;
&lt;CODE&gt;[&lt;/CODE&gt;is meta character.&lt;BR /&gt;
your &lt;CODE&gt;| regex _raw="[(?&amp;lt;jail&amp;gt;sshd)]"&lt;/CODE&gt; searches the word &lt;CODE&gt;sshd&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;see following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  \       general escape character with several uses
  ^      assert start of string (or line, in multiline mode)
  $      assert end of string (or line, in multiline mode)
  .      match any character except newline (by default)
  [      start character class definition
  |      start of alternative branch
  (      start subpattern
  )      end subpattern
  ?      extends the meaning of (
         also 0 or 1 quantifier
         also quantifier minimizer
  *      0 or more quantifier
  +      1 or more quantifier
         also "possessive quantifier"
  {      start min/max quantifier
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://www.pcre.org/original/doc/html/pcrepattern.html"&gt;https://www.pcre.org/original/doc/html/pcrepattern.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Apr 2020 13:15:47 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-04-01T13:15:47Z</dc:date>
    <item>
      <title>Regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462427#M130366</link>
      <description>&lt;P&gt;I am at a loss as to why the following is not working. &lt;BR /&gt;
log:&lt;BR /&gt;
   2020-03-31 20:31:19,621 fail2ban.actions        [709]: NOTICE  [sshd] Unban 156.38.x.x&lt;BR /&gt;
Query&lt;BR /&gt;
    index=main fail2ban.actions | regex _raw="[(?&lt;JAIL&gt;sshd)]" | fields jail&lt;BR /&gt;
I have double checked the regular expression with regex101 and "sshd" is captured in group jail. &lt;BR /&gt;
Am i missing something?&lt;BR /&gt;
Splunk Enterprise 8.0.2.1&lt;/JAIL&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 02:23:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462427#M130366</guid>
      <dc:creator>vlape_SCWX</dc:creator>
      <dc:date>2020-04-01T02:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462428#M130367</link>
      <description>&lt;P&gt;For some reason the \ before [ was stripped when posting the question. &lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 02:25:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462428#M130367</guid>
      <dc:creator>vlape_SCWX</dc:creator>
      <dc:date>2020-04-01T02:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462429#M130368</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Use Code Sample or press Ctrl +k while posting your query&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 05:01:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462429#M130368</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2020-04-01T05:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462430#M130369</link>
      <description>&lt;P&gt;@vlape_SCWX can you try something like the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main fail2ban.actions 
| rex "\[(?&amp;lt;jail&amp;gt;sshd)\]" 
| table jail _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Not sure what you want to pull with hard-coded &lt;CODE&gt;sshd&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 07:19:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462430#M130369</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-04-01T07:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462431#M130370</link>
      <description>&lt;PRE&gt;&lt;CODE&gt; index=main fail2ban.actions sshd
| rex "\[(?&amp;lt;jail&amp;gt;[a-z]+)\]"
| fields jail
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;regex: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Regex"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Regex&lt;/A&gt;&lt;BR /&gt;
rex: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;what do you want to do? &lt;BR /&gt;
&lt;CODE&gt;[&lt;/CODE&gt;is meta character.&lt;BR /&gt;
your &lt;CODE&gt;| regex _raw="[(?&amp;lt;jail&amp;gt;sshd)]"&lt;/CODE&gt; searches the word &lt;CODE&gt;sshd&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;see following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  \       general escape character with several uses
  ^      assert start of string (or line, in multiline mode)
  $      assert end of string (or line, in multiline mode)
  .      match any character except newline (by default)
  [      start character class definition
  |      start of alternative branch
  (      start subpattern
  )      end subpattern
  ?      extends the meaning of (
         also 0 or 1 quantifier
         also quantifier minimizer
  *      0 or more quantifier
  +      1 or more quantifier
         also "possessive quantifier"
  {      start min/max quantifier
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://www.pcre.org/original/doc/html/pcrepattern.html"&gt;https://www.pcre.org/original/doc/html/pcrepattern.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 13:15:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462431#M130370</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-01T13:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462432#M130371</link>
      <description>&lt;P&gt;That worked! thanks you. Why is it when I search for the exact match it returns nothing?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 17:10:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462432#M130371</guid>
      <dc:creator>vlape_SCWX</dc:creator>
      <dc:date>2020-04-01T17:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462433#M130372</link>
      <description>&lt;P&gt;&lt;CODE&gt;regex&lt;/CODE&gt; is search, not field extract command. &lt;BR /&gt;
so, field &lt;EM&gt;jail&lt;/EM&gt; is missing.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 18:49:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/462433#M130372</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-01T18:49:30Z</dc:date>
    </item>
  </channel>
</rss>

