<?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: How to escape the end bracket using rex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-the-end-bracket-using-rex/m-p/389606#M113523</link>
    <description>&lt;P&gt;Try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "myfield2:\s*(?&amp;lt;myextractvalue2&amp;gt;[^\]]*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "myfield2:\s*(?&amp;lt;myextractvalue2&amp;gt;.*?)\]"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 20 Jun 2018 13:56:47 GMT</pubDate>
    <dc:creator>cpetterborg</dc:creator>
    <dc:date>2018-06-20T13:56:47Z</dc:date>
    <item>
      <title>How to escape the end bracket using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-the-end-bracket-using-rex/m-p/389605#M113522</link>
      <description>&lt;P&gt;I've read the threads on escaping the parens and the such.  But I'm trying to do the "]".  I thought I would be able to just swap the ")" for "]" in the rex command but it doesn't work.&lt;/P&gt;

&lt;P&gt;Line: ....[Status: 4] [myfield2: myvalue2][myfield3:myvalue3] [myfield4:myvalue4]&lt;/P&gt;

&lt;P&gt;So I've tried the following to extract field2 as value2.  The closest one I get is the first and second one.  I get the field to extract, but it doesn't cut off on the "]" after it (so the values look like: myvalue2][myfield3:myvalue3] [myfield4:myvalue4])&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "myfield2: (?&amp;lt;myextractvalue2&amp;gt;.*)\\]"

rex field=_raw "myfield2: (?&amp;lt;myextractvalue2&amp;gt;.*)\]"

rex field=_raw "myfield2: (?&amp;lt;myextractvalue2&amp;gt;\w)\\]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help would be greatly appreciated.  Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 13:43:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-the-end-bracket-using-rex/m-p/389605#M113522</guid>
      <dc:creator>rbdev</dc:creator>
      <dc:date>2018-06-20T13:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape the end bracket using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-the-end-bracket-using-rex/m-p/389606#M113523</link>
      <description>&lt;P&gt;Try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "myfield2:\s*(?&amp;lt;myextractvalue2&amp;gt;[^\]]*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "myfield2:\s*(?&amp;lt;myextractvalue2&amp;gt;.*?)\]"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jun 2018 13:56:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-the-end-bracket-using-rex/m-p/389606#M113523</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2018-06-20T13:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape the end bracket using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-the-end-bracket-using-rex/m-p/389607#M113524</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;this should do :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval someField="[Status: 4] [myfield2: myvalue2][myfield3:myvalue3] [myfield4:myvalue4]"
| rex field=someField "myfield2: (?&amp;lt;myextractvalue2&amp;gt;[A-Za-z0-9]+)" 
| rex field=someField "myfield3:(?&amp;lt;myextractvalue3&amp;gt;[A-Za-z0-9]+)"
| rex field=someField "myfield4:(?&amp;lt;myextractvalue4&amp;gt;[A-Za-z0-9]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jun 2018 13:59:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-the-end-bracket-using-rex/m-p/389607#M113524</guid>
      <dc:creator>poete</dc:creator>
      <dc:date>2018-06-20T13:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape the end bracket using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-the-end-bracket-using-rex/m-p/389608#M113525</link>
      <description>&lt;P&gt;EXCELLENT!!  Thank you!  The second actually worked better for me.  The first one sometimes cut the value for some reason.  But the second one perfect!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 14:01:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-the-end-bracket-using-rex/m-p/389608#M113525</guid>
      <dc:creator>rbdev</dc:creator>
      <dc:date>2018-06-20T14:01:31Z</dc:date>
    </item>
  </channel>
</rss>

