<?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: Simple regex for capturing text between strings with different end anchors in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222976#M65581</link>
    <description>&lt;P&gt;Not sure if you'd need a transform.conf for this. You just put it in props.conf as EXTRACT&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
EXTRACT-message = Exception=(?&amp;lt;Message&amp;gt;.+)(\n|:|\.\s+-\s\w{8}-\w{4}-\w{4}-\w{4}-\w{12})
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR from Splunk web, Fields-&amp;gt; Fields Extraction&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jun 2016 18:31:27 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-06-20T18:31:27Z</dc:date>
    <item>
      <title>Simple regex for capturing text between strings with different end anchors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222972#M65577</link>
      <description>&lt;P&gt;I've been battling this, and I'm not sure if it's a bug in Splunk or what. This is for a field extraction.&lt;/P&gt;

&lt;P&gt;I simply need to grab all text between the following character strings and assign a field name.&lt;/P&gt;

&lt;P&gt;Here is an example event snippet:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Exception=12567 - INSURANCE_BOOKING - Sorry we are unable to cancel your Insurance as your coverage has already started, please refer to our Terms and conditions for cancellation policies. - aa5f6710-baa5-49c1-8efa-96c3b13a4cbf
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to capture everything between &lt;CODE&gt;Exception=&lt;/CODE&gt; and &lt;CODE&gt;\n&lt;/CODE&gt; OR &lt;CODE&gt;. - GUID&lt;/CODE&gt; OR &lt;CODE&gt;:&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2016 17:49:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222972#M65577</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2016-06-20T17:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Simple regex for capturing text between strings with different end anchors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222973#M65578</link>
      <description>&lt;P&gt;Try something like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search| rex field=_raw "Exception=(?&amp;lt;Message&amp;gt;.+)(\n|:|\.\s+-\s\w{8}-\w{4}-\w{4}-\w{4}-\w{12})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Run anywhere sample with all three cases&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval _raw="Exception=12567 - INSURANCE_BOOKING - Sorry we are unable to cancel your Insurance as your coverage has already started, please refer to our Terms and conditions for cancellation policies. - aa5f6710-baa5-49c1-8efa-96c3b13a4cbf" | table _raw | append [| gentimes start=-1 | eval _raw="Exception=12567 - INSURANCE_BOOKING - Sorry we are unable to cancel your Insurance as your coverage has already started, please refer to our Terms and conditions for cancellation policies
dfd. - aa5f6710-baa5-49c1-8efa-96c3b13a4cbf" | table _raw ]| append [| gentimes start=-1 | eval _raw="Exception=12567 - INSURANCE_BOOKING - Sorry we are unable to cancel your Insurance as your coverage has already started, please refer to our Terms and conditions for cancellation policies: additional text for test"  | table _raw]| rex field=_raw "Exception=(?&amp;lt;Message&amp;gt;.+)(\n|:|\.\s+-\s\w{8}-\w{4}-\w{4}-\w{4}-\w{12})"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jun 2016 18:03:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222973#M65578</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-20T18:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Simple regex for capturing text between strings with different end anchors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222974#M65579</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "(?ms)Exception=(?&amp;lt;MyCapture&amp;gt;.[^\r\n:]+?)(?:[\r\n]|:|\.?\s+-\s+\w{8}-\w{4}-\w{4}-\w{4}-\w{12}|$)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jun 2016 18:03:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222974#M65579</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-06-20T18:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Simple regex for capturing text between strings with different end anchors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222975#M65580</link>
      <description>&lt;P&gt;How would this look in a field extraction transform?  It does not seem to work when declared&lt;BR /&gt;
(?i)Exception=(?.+)(\n|:|.\s+-\s\w{8}-\w{4}-\w{4}-\w{4}-\w{12})&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2016 18:25:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222975#M65580</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2016-06-20T18:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: Simple regex for capturing text between strings with different end anchors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222976#M65581</link>
      <description>&lt;P&gt;Not sure if you'd need a transform.conf for this. You just put it in props.conf as EXTRACT&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
EXTRACT-message = Exception=(?&amp;lt;Message&amp;gt;.+)(\n|:|\.\s+-\s\w{8}-\w{4}-\w{4}-\w{4}-\w{12})
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR from Splunk web, Fields-&amp;gt; Fields Extraction&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2016 18:31:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222976#M65581</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-20T18:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Simple regex for capturing text between strings with different end anchors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222977#M65582</link>
      <description>&lt;P&gt;This seems close but still contains the GUIDS&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2016 18:31:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222977#M65582</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2016-06-20T18:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: Simple regex for capturing text between strings with different end anchors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222978#M65583</link>
      <description>&lt;P&gt;This unfortunately does not break upon reaching any of the end anchors, but rather assigns all text to end of the event to "Message"&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2016 18:35:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222978#M65583</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2016-06-20T18:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Simple regex for capturing text between strings with different end anchors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222979#M65584</link>
      <description>&lt;P&gt;Could you try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; EXTRACT-message = Exception=(?&amp;lt;Message&amp;gt;.+)(:|(\.\s+-\s+\w{8}-\w{4}-\w{4}-\w{4}-\w{12})|[\r\n])
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jun 2016 18:39:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222979#M65584</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-20T18:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Simple regex for capturing text between strings with different end anchors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222980#M65585</link>
      <description>&lt;P&gt;Show me non-conforming data and I can adjust.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2016 18:48:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222980#M65585</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-06-20T18:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Simple regex for capturing text between strings with different end anchors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222981#M65586</link>
      <description>&lt;P&gt;Exception=BAD_EXTERNAL_DATA - VOYAGER - Los datos indicados por el sistema externo no son los esperados - aa39147e-2cdb-47d8-a167-7175eff6496a&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:01:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222981#M65586</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2020-09-29T10:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Simple regex for capturing text between strings with different end anchors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222982#M65587</link>
      <description>&lt;P&gt;You said OR &lt;CODE&gt;. - GUID&lt;/CODE&gt; and this example does not have a period.  I made the period optional and updated my original answer.  It should work for both cases now.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2016 19:13:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222982#M65587</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-06-20T19:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Simple regex for capturing text between strings with different end anchors</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222983#M65588</link>
      <description>&lt;P&gt;This is awesome, thanks! I can use this to deconstruct the syntax for other variables.  I was working from a lot of documentation on regex, and I swear was doing things as documented and having crap luck.  I really need to sit down and take an in depth refresher on regex.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2016 19:44:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-regex-for-capturing-text-between-strings-with-different/m-p/222983#M65588</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2016-06-20T19:44:58Z</dc:date>
    </item>
  </channel>
</rss>

