<?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 throwing Mismatch Mismatched ']' in search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499528#M139129</link>
    <description>&lt;P&gt;Hi Manoshanni, I solved you initial question, telling you why the error occurred. I gave you a regex that works like a charm on the data that you have provided and your comment PC, JP makes no sense to me. If you would like to ignore the "iron" and just return the "pc", "jp" ... you should have only had those in bold. &lt;CODE&gt;| rex field=_raw "^\[(?&amp;lt;time&amp;gt;[^\]]+)\][^/]*/iron(?&amp;lt;app&amp;gt;\w+)/"&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 18 May 2020 09:41:26 GMT</pubDate>
    <dc:creator>ololdach</dc:creator>
    <dc:date>2020-05-18T09:41:26Z</dc:date>
    <item>
      <title>Regex throwing Mismatch Mismatched ']' in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499518#M139119</link>
      <description>&lt;P&gt;I am a beginner for Regex and Splunk. I am trying to use regular expression generated during field extraction in online search because I have different sourcetypes. While using the regex i am getting Mismatched ']'. error.&lt;/P&gt;

&lt;P&gt;rex "^[^[\n]&lt;EM&gt;[(?P[^ ]+)[^"\n]&lt;/EM&gt;"\w+(?P\s+/\w+)"&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 08:28:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499518#M139119</guid>
      <dc:creator>Manoshanni</dc:creator>
      <dc:date>2020-05-15T08:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: Regex throwing Mismatch Mismatched ']' in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499519#M139120</link>
      <description>&lt;P&gt;Hello @Manoshanni&lt;/P&gt;

&lt;P&gt;this regex is not correct, you can test it here: &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Post few raw events here so somebody can help you to build a correct regex. Regexes created using field extraction tool are usually not very practical.&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 08:56:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499519#M139120</guid>
      <dc:creator>PavelP</dc:creator>
      <dc:date>2020-05-15T08:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Regex throwing Mismatch Mismatched ']' in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499520#M139121</link>
      <description>&lt;P&gt;Please edit the example regex above and make it be code text formatted by using the 101010 formatting button to make it so that all your characters are visible. It's likely that the&lt;CODE&gt;*&lt;/CODE&gt; characters can be guessed, but there could be other characters that are missing.&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 08:59:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499520#M139121</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2020-05-15T08:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Regex throwing Mismatch Mismatched ']' in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499521#M139122</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
all brackets () [] {} always have to come in pairs. They all have special meanings in regex and must be closed. The "Mismatch" error tells you that you have a bracket that is missing its counterpart. It's hard to tell exactly what you need, because you've not included the data sample and the result you'd like to get, but I assume that you want something like this:&lt;BR /&gt;
&lt;CODE&gt;rex "^[[^\n][(?&amp;lt;fieldnameA)[^ ]+)[^\"\n]\"\w+(?&amp;lt;fieldnameB&amp;gt;\s+/\w+)"&lt;/CODE&gt;&lt;BR /&gt;
Note the two \" that differ from your regex. Since the " closes your regex string prematurely (giving you a bracket error), they need to be escaped by \" if you want to search your data for a " character. Also, you might want to include fieldnames in your regex.&lt;BR /&gt;
Hope it helps&lt;BR /&gt;
Oliver&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 09:05:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499521#M139122</guid>
      <dc:creator>ololdach</dc:creator>
      <dc:date>2020-05-15T09:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Regex throwing Mismatch Mismatched ']' in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499522#M139123</link>
      <description>&lt;P&gt;I am trying to extract data from web server logs.&lt;/P&gt;

&lt;P&gt;Below  are the sample logs, I am trying to extract the timestamp and the application the call is hitting. Doing this for primarily  getting the web traffic&lt;/P&gt;

&lt;P&gt;[&lt;STRONG&gt;15/May/2020:03:51:10&lt;/STRONG&gt; -0400] "GET &lt;STRONG&gt;/ironpc&lt;/STRONG&gt;/services/restapi....&lt;BR /&gt;
[&lt;STRONG&gt;15/May/2020:03:50:10&lt;/STRONG&gt; -0400] "GET &lt;STRONG&gt;/ironjp&lt;/STRONG&gt;/rest/userdata...&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 09:29:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499522#M139123</guid>
      <dc:creator>Manoshanni</dc:creator>
      <dc:date>2020-05-15T09:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Regex throwing Mismatch Mismatched ']' in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499523#M139124</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
try this: &lt;CODE&gt;| rex field=_raw "^\[(?&amp;lt;time&amp;gt;[^\]]+)\][^/]*/(?&amp;lt;app&amp;gt;\w+)/"&lt;/CODE&gt;`&lt;BR /&gt;
HiH&lt;BR /&gt;
Oliver&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 09:35:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499523#M139124</guid>
      <dc:creator>ololdach</dc:creator>
      <dc:date>2020-05-15T09:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: Regex throwing Mismatch Mismatched ']' in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499524#M139125</link>
      <description>&lt;P&gt;@Manoshanni&lt;/P&gt;

&lt;P&gt;if this one of the major web servers than there is an add-on for it, which does the parsing of all/most fields for you:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://splunkbase.splunk.com/app/3186/"&gt;https://splunkbase.splunk.com/app/3186/&lt;/A&gt; Apache / httpd&lt;/P&gt;

&lt;P&gt;&lt;A href="https://splunkbase.splunk.com/app/3258/"&gt;https://splunkbase.splunk.com/app/3258/&lt;/A&gt; nginx&lt;/P&gt;

&lt;P&gt;etc&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 09:49:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499524#M139125</guid>
      <dc:creator>PavelP</dc:creator>
      <dc:date>2020-05-15T09:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Regex throwing Mismatch Mismatched ']' in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499525#M139126</link>
      <description>&lt;P&gt;Thank you. But its not matching the pattern&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 11:01:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499525#M139126</guid>
      <dc:creator>Manoshanni</dc:creator>
      <dc:date>2020-05-15T11:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Regex throwing Mismatch Mismatched ']' in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499526#M139127</link>
      <description>&lt;P&gt;How so? It is on my side of the screen &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;CODE&gt;| makeresults | eval _raw="[15/May/2020:03:51:10 -0400] \"GET /ironpc/services/restapi...." | rex field=_raw "^\[(?&amp;lt;time&amp;gt;[^\]]+)\][^/]*/(?&amp;lt;app&amp;gt;\w+)/"&lt;/CODE&gt;&lt;BR /&gt;
Maybe the event data is not in the _raw field? What part is not matching?&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 11:06:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499526#M139127</guid>
      <dc:creator>ololdach</dc:creator>
      <dc:date>2020-05-15T11:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: Regex throwing Mismatch Mismatched ']' in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499527#M139128</link>
      <description>&lt;P&gt;Time field is extracting as expected. App field is returning values as PC,JP &lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 12:19:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499527#M139128</guid>
      <dc:creator>Manoshanni</dc:creator>
      <dc:date>2020-05-15T12:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Regex throwing Mismatch Mismatched ']' in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499528#M139129</link>
      <description>&lt;P&gt;Hi Manoshanni, I solved you initial question, telling you why the error occurred. I gave you a regex that works like a charm on the data that you have provided and your comment PC, JP makes no sense to me. If you would like to ignore the "iron" and just return the "pc", "jp" ... you should have only had those in bold. &lt;CODE&gt;| rex field=_raw "^\[(?&amp;lt;time&amp;gt;[^\]]+)\][^/]*/iron(?&amp;lt;app&amp;gt;\w+)/"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2020 09:41:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-throwing-Mismatch-Mismatched-in-search/m-p/499528#M139129</guid>
      <dc:creator>ololdach</dc:creator>
      <dc:date>2020-05-18T09:41:26Z</dc:date>
    </item>
  </channel>
</rss>

