<?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: rex value up until 2 optional words in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/rex-value-up-until-2-optional-words/m-p/145884#M40710</link>
    <description>&lt;P&gt;Hmm, I kinda figured this would be harder to explain.  I needed to provide better examples.  I edited the events.  Basically it HAS to look for an end anchor that can be multiple strings.  &lt;/P&gt;

&lt;P&gt;Message=This is the. -  error I want. - ea1ff4f5-8c97-4ac4-9ba1-0f533a33f62b&lt;/P&gt;

&lt;P&gt;Message=This. -  is the error I want&lt;/P&gt;</description>
    <pubDate>Thu, 16 Apr 2015 18:51:09 GMT</pubDate>
    <dc:creator>Cuyose</dc:creator>
    <dc:date>2015-04-16T18:51:09Z</dc:date>
    <item>
      <title>rex value up until 2 optional words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-value-up-until-2-optional-words/m-p/145882#M40708</link>
      <description>&lt;P&gt;If I wanted to find the string "This is the error I want" in the following 2 events, what would the rex look like.  I can't believe its not a common issue as I can not find a syntax in documentation anywhere that works&lt;/P&gt;

&lt;P&gt;Message=This is the error I want. - ea1ff4f5-8c97-4ac4-9ba1-0f533a33f62b&lt;/P&gt;

&lt;P&gt;Message=This is the error I want&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2015 18:37:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-value-up-until-2-optional-words/m-p/145882#M40708</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2015-04-16T18:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: rex value up until 2 optional words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-value-up-until-2-optional-words/m-p/145883#M40709</link>
      <description>&lt;P&gt;Assuming there aren't any periods in the error you want, you could do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex "Message=(?&amp;lt;Yourfieldname&amp;gt;[^\.]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If there are periods, you could do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex "Message=(?&amp;lt;Yourfieldnamehere&amp;gt;[^\s\-\s]+)\s\-\s"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex "Message=(?&amp;lt;Yourfieldnamehere&amp;gt;.+)\s\-\s"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can also try out your own expressions at: &lt;A href="http://www.regexr.com/"&gt;http://www.regexr.com/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2015 18:47:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-value-up-until-2-optional-words/m-p/145883#M40709</guid>
      <dc:creator>masonmorales</dc:creator>
      <dc:date>2015-04-16T18:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: rex value up until 2 optional words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-value-up-until-2-optional-words/m-p/145884#M40710</link>
      <description>&lt;P&gt;Hmm, I kinda figured this would be harder to explain.  I needed to provide better examples.  I edited the events.  Basically it HAS to look for an end anchor that can be multiple strings.  &lt;/P&gt;

&lt;P&gt;Message=This is the. -  error I want. - ea1ff4f5-8c97-4ac4-9ba1-0f533a33f62b&lt;/P&gt;

&lt;P&gt;Message=This. -  is the error I want&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2015 18:51:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-value-up-until-2-optional-words/m-p/145884#M40710</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2015-04-16T18:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: rex value up until 2 optional words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-value-up-until-2-optional-words/m-p/145885#M40711</link>
      <description>&lt;P&gt;Sorry, I'm not following. Perhaps you could explain another way? Also, please note that it is discourteous to down vote answers of people that are trying to help you.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2015 20:30:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-value-up-until-2-optional-words/m-p/145885#M40711</guid>
      <dc:creator>masonmorales</dc:creator>
      <dc:date>2015-04-17T20:30:19Z</dc:date>
    </item>
  </channel>
</rss>

