<?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: Issue with rex regular expression repeating charatacer matching in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Issue-with-rex-regular-expression-repeating-character-matching/m-p/632268#M15508</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to use comma not hyphen&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;\w{4,5}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 26 Feb 2023 10:42:34 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-02-26T10:42:34Z</dc:date>
    <item>
      <title>Issue with rex regular expression repeating character matching?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Issue-with-rex-regular-expression-repeating-character-matching/m-p/632267#M15507</link>
      <description>&lt;P&gt;Using Splunk enterprise 8.2.5 and trying to match a string of repeating characters in my Events. For example of the log file I'm ingesting&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;INFO - Service Started
DEBUG - Service suspended&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I was testing this as follows but the field &lt;STRONG&gt;mylevel&lt;/STRONG&gt; is not extracted&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| makeresults | eval msg="info"| rex field=msg "(?&amp;lt;mylevel&amp;gt;\w{4-5})"
| table mylevel&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This works though&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| makeresults | eval msg="info"| rex field=msg "(?&amp;lt;mylevel&amp;gt;(\w{4})|(\w{5}))" 
|  table mylevel&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is incorrect/wrong with my usage of this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;\w{4-5}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 16:36:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Issue-with-rex-regular-expression-repeating-character-matching/m-p/632267#M15507</guid>
      <dc:creator>shocko</dc:creator>
      <dc:date>2023-02-28T16:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with rex regular expression repeating charatacer matching</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Issue-with-rex-regular-expression-repeating-character-matching/m-p/632268#M15508</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to use comma not hyphen&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;\w{4,5}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Feb 2023 10:42:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Issue-with-rex-regular-expression-repeating-character-matching/m-p/632268#M15508</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-02-26T10:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with rex regular expression repeating charatacer matching</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Issue-with-rex-regular-expression-repeating-character-matching/m-p/632284#M15511</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex field=msg "(?&amp;lt;mylevel&amp;gt;\w{4,5})"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think this is wrong approach.&amp;nbsp; It will mach any word with 4 or 5 characters within msg field.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;Some better would be:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=msg "^(?&amp;lt;mylevel&amp;gt;\w{4-5})"&lt;/LI-CODE&gt;&lt;P&gt;The ^ makes sure text are on start of the line.&lt;/P&gt;&lt;P&gt;Even better:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=msg "(?&amp;lt;mylevel&amp;gt;(?:INFO|DEBUG))"
or
| rex field=msg "(?&amp;lt;mylevel&amp;gt;(?:INFO|DEBUG|ERROR))"&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 26 Feb 2023 09:40:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Issue-with-rex-regular-expression-repeating-character-matching/m-p/632284#M15511</guid>
      <dc:creator>jotne</dc:creator>
      <dc:date>2023-02-26T09:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with rex regular expression repeating charatacer matching</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Issue-with-rex-regular-expression-repeating-character-matching/m-p/632301#M15512</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;I can't believe I missed that! Wood for the trees and been at a computer screen too long. Should have re-read the docs.&lt;/P&gt;&lt;P&gt;Thanks for taking the time to answer. Much appreciated!&lt;/P&gt;</description>
      <pubDate>Sun, 26 Feb 2023 23:53:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Issue-with-rex-regular-expression-repeating-character-matching/m-p/632301#M15512</guid>
      <dc:creator>shocko</dc:creator>
      <dc:date>2023-02-26T23:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with rex regular expression repeating charatacer matching</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Issue-with-rex-regular-expression-repeating-character-matching/m-p/632370#M15519</link>
      <description>&lt;P&gt;Remember as I told you, its not an optimal regex.&amp;nbsp; IT will hit multiple times in the line and if first word is not 4 or 5 characters log, it will try next word that is 4 or 5 characters long.&lt;BR /&gt;&lt;A href="https://regex101.com/r/7OSbxb/1" target="_blank"&gt;https://regex101.com/r/7OSbxb/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Some better:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;^(?&amp;lt;mylevel&amp;gt;\w{4,5})&lt;/LI-CODE&gt;&lt;P&gt;even better&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;^(?&amp;lt;mylevel&amp;gt;\S+)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 27 Feb 2023 14:03:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Issue-with-rex-regular-expression-repeating-character-matching/m-p/632370#M15519</guid>
      <dc:creator>jotne</dc:creator>
      <dc:date>2023-02-27T14:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with rex regular expression repeating charatacer matching</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Issue-with-rex-regular-expression-repeating-character-matching/m-p/632536#M15524</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213488"&gt;@jotne&lt;/a&gt;&amp;nbsp;and your point is well noted. I was using a simple example but I have used ^ and $ for start/end markers for my production regex.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 10:19:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Issue-with-rex-regular-expression-repeating-character-matching/m-p/632536#M15524</guid>
      <dc:creator>shocko</dc:creator>
      <dc:date>2023-02-28T10:19:13Z</dc:date>
    </item>
  </channel>
</rss>

