<?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: Unmatched parentheses error with replace in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Unmatched-parentheses-error-with-replace/m-p/239047#M71031</link>
    <description>&lt;P&gt;Hi bruceclarke,&lt;/P&gt;

&lt;P&gt;you need to escape the parentheses so Splunk will not use them:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | stats count | eval foo="This is ) ( my message" | eval BaselineActual=replace(foo,"\) \(",")&amp;lt;NEWLINE&amp;gt;(")
 | makemv delim="&amp;lt;NEWLINE&amp;gt;" BaselineActual
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or adapted to your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; {baseSearch}
 | eval BaselineActual=replace(BaselineActual,"\) \(",")&amp;lt;NEWLINE&amp;gt;(")
 | makemv delim="&amp;lt;NEWLINE&amp;gt;" BaselineActual 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
    <pubDate>Wed, 09 Mar 2016 20:05:31 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2016-03-09T20:05:31Z</dc:date>
    <item>
      <title>Unmatched parentheses error with replace</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unmatched-parentheses-error-with-replace/m-p/239046#M71030</link>
      <description>&lt;P&gt;The following search is complaining about an unmatched parenthesis. Since the parentheses are inside of quotes, shouldn't the parser not care? Does anyone have a workaround?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{baseSearch}
| eval BaselineActual=replace(BaselineActual,") (",")&amp;lt;NEWLINE&amp;gt;(")
| makemv delim="&amp;lt;NEWLINE&amp;gt;" BaselineActual 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Mar 2016 19:59:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unmatched-parentheses-error-with-replace/m-p/239046#M71030</guid>
      <dc:creator>bruceclarke</dc:creator>
      <dc:date>2016-03-09T19:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: Unmatched parentheses error with replace</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unmatched-parentheses-error-with-replace/m-p/239047#M71031</link>
      <description>&lt;P&gt;Hi bruceclarke,&lt;/P&gt;

&lt;P&gt;you need to escape the parentheses so Splunk will not use them:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | stats count | eval foo="This is ) ( my message" | eval BaselineActual=replace(foo,"\) \(",")&amp;lt;NEWLINE&amp;gt;(")
 | makemv delim="&amp;lt;NEWLINE&amp;gt;" BaselineActual
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or adapted to your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; {baseSearch}
 | eval BaselineActual=replace(BaselineActual,"\) \(",")&amp;lt;NEWLINE&amp;gt;(")
 | makemv delim="&amp;lt;NEWLINE&amp;gt;" BaselineActual 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2016 20:05:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unmatched-parentheses-error-with-replace/m-p/239047#M71031</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-03-09T20:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Unmatched parentheses error with replace</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unmatched-parentheses-error-with-replace/m-p/239048#M71032</link>
      <description>&lt;P&gt;Thanks MuS! I was actually playing around with this more and came to a similar conclusion. Ultimately this didn't work for me either.&lt;/P&gt;

&lt;P&gt;Turns out that what I assumed was a space might actually be some other whitespace character. I was able to use the following to get it to work (note that "\s" matches any whitespace character):&lt;BR /&gt;
    {baseSearch}&lt;BR /&gt;
    | eval BaselineActual=replace(BaselineActual,")\s(",")&lt;NEWLINE&gt;(")&lt;BR /&gt;
    | makemv delim="&lt;NEWLINE&gt;" BaselineActual &lt;/NEWLINE&gt;&lt;/NEWLINE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2016 20:34:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unmatched-parentheses-error-with-replace/m-p/239048#M71032</guid>
      <dc:creator>bruceclarke</dc:creator>
      <dc:date>2016-03-09T20:34:05Z</dc:date>
    </item>
  </channel>
</rss>

