<?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: Why am I getting &amp;quot;Error in 'rex' command...Regex: missing )&amp;quot;? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-quot-Error-in-rex-command-Regex-missing-quot/m-p/207886#M60590</link>
    <description>&lt;P&gt;I'm assuming your sample data in question is showing data to be extracted from 3 different events. &lt;BR /&gt;
You Sample data has variable number of strings (enclosed between numbers). Is that correct? Could you post full raw event as well?&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2015 15:39:15 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2015-09-09T15:39:15Z</dc:date>
    <item>
      <title>Why am I getting "Error in 'rex' command...Regex: missing )"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-quot-Error-in-rex-command-Regex-missing-quot/m-p/207884#M60588</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;

&lt;P&gt;I am brand new to Splunk and can't for the life of me figure out what I am doing wrong.  I would like to pull the following data from raw text (about 10 lines of so of raw text), extract to a new field and then replace data in that field from paren number paren with a period.  So (number) with . &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Sample data
(1)dkfj(10)dkeiieii(2)ljflkkldj(3)
(2)datadata(1)dta(10)dat(2)
(8)sample(3)sample(0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am using the following command in Splunk, but when I try to display the results, I get blank data: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;tag=unencoded | rex "(?&amp;lt;formatEncode&amp;gt;(\(\d+\))(\w+\(\d+\))+\w+(\(\d+\))" | rex mode=sed field=formatEncode "s/([0-9])/./g"  | stats by formatEncode
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tested the regex and the sed substitution and both work just fine. I get the following error when I try to run it in Splunk:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'rex' command: Encountered the following error while compiling the regex '(?&amp;lt;formatEncode&amp;lt;(\(\d+\))(\w+\(\d+\))+\w+(\(\d+\))': Regex: missing )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help or pointer would be greatly appreciated.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 15:02:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-quot-Error-in-rex-command-Regex-missing-quot/m-p/207884#M60588</guid>
      <dc:creator>splunker1981</dc:creator>
      <dc:date>2015-09-09T15:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I getting "Error in 'rex' command...Regex: missing )"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-quot-Error-in-rex-command-Regex-missing-quot/m-p/207885#M60589</link>
      <description>&lt;P&gt;Looks like you are missing a bracket at the end of your first rex command.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 15:16:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-quot-Error-in-rex-command-Regex-missing-quot/m-p/207885#M60589</guid>
      <dc:creator>dkoops</dc:creator>
      <dc:date>2015-09-09T15:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I getting "Error in 'rex' command...Regex: missing )"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-quot-Error-in-rex-command-Regex-missing-quot/m-p/207886#M60590</link>
      <description>&lt;P&gt;I'm assuming your sample data in question is showing data to be extracted from 3 different events. &lt;BR /&gt;
You Sample data has variable number of strings (enclosed between numbers). Is that correct? Could you post full raw event as well?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2015 15:39:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-quot-Error-in-rex-command-Regex-missing-quot/m-p/207886#M60590</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-09-09T15:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I getting "Error in 'rex' command...Regex: missing )"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-quot-Error-in-rex-command-Regex-missing-quot/m-p/207887#M60591</link>
      <description>&lt;P&gt;Actually that was the issue, thanks. &lt;/P&gt;

&lt;P&gt;For those trying to do something similar here is the command I used &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex "(?(\(\d+\))([A-Za-z0-9_\-]+\(\d+\))+\w+(\(\d+\)))" | rex mode=sed field=formatEncode "s/\([0-9]\)/./g" | stats by formatEncode
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Sep 2015 15:44:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-getting-quot-Error-in-rex-command-Regex-missing-quot/m-p/207887#M60591</guid>
      <dc:creator>splunker1981</dc:creator>
      <dc:date>2015-09-09T15:44:20Z</dc:date>
    </item>
  </channel>
</rss>

