<?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 How do I edit my rex search to extract a string between two other strings from a sample line of data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-rex-search-to-extract-a-string-between-two/m-p/188419#M54274</link>
    <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;How do I get "&lt;A href="mailto:x868686@test.com"&gt;x868686@test.com&lt;/A&gt;" between "Account:" and "Source Workstation:" from following text:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Account: x868686@test.com Source Workstation:
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=abcd" | rex field=test "^d+:d+: Account : (?&amp;lt;txid&amp;gt;.*?) : Source Workstation" | fields account
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but still doesn't work.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Aug 2015 11:43:48 GMT</pubDate>
    <dc:creator>chlily</dc:creator>
    <dc:date>2015-08-28T11:43:48Z</dc:date>
    <item>
      <title>How do I edit my rex search to extract a string between two other strings from a sample line of data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-rex-search-to-extract-a-string-between-two/m-p/188419#M54274</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;How do I get "&lt;A href="mailto:x868686@test.com"&gt;x868686@test.com&lt;/A&gt;" between "Account:" and "Source Workstation:" from following text:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Account: x868686@test.com Source Workstation:
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=abcd" | rex field=test "^d+:d+: Account : (?&amp;lt;txid&amp;gt;.*?) : Source Workstation" | fields account
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but still doesn't work.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 11:43:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-rex-search-to-extract-a-string-between-two/m-p/188419#M54274</guid>
      <dc:creator>chlily</dc:creator>
      <dc:date>2015-08-28T11:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my rex search to extract a string between two other strings from a sample line of data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-rex-search-to-extract-a-string-between-two/m-p/188420#M54275</link>
      <description>&lt;P&gt;You seem to have a number of extra colons (:) in your regex that you don't need.&lt;/P&gt;

&lt;P&gt;Try the following. Use field=_raw unless there is a field that contains everything from "Account:" to "Source Workstation".&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=abcd | rex field=_raw "Account: (?P&amp;lt;account&amp;gt;[^\s]+) Source Workstation" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That should extract everything that isn't a whitespace (\s) between "Account: " and " Source" into a field called "account".&lt;/P&gt;

&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 13:10:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-rex-search-to-extract-a-string-between-two/m-p/188420#M54275</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2015-08-28T13:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my rex search to extract a string between two other strings from a sample line of data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-rex-search-to-extract-a-string-between-two/m-p/188421#M54276</link>
      <description>&lt;P&gt;The following rex places &lt;A href="mailto:x868686@test.com"&gt;x868686@test.com&lt;/A&gt; in txid:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search here&amp;gt; | rex field=_raw ".*Account:\s+(?&amp;lt;txid&amp;gt;\S+)\s+Source Workstation:.*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I assume there is always a space before and after the txid, and never a space in the txid&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2015 13:14:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-rex-search-to-extract-a-string-between-two/m-p/188421#M54276</guid>
      <dc:creator>FritzWittwer_ol</dc:creator>
      <dc:date>2015-08-28T13:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my rex search to extract a string between two other strings from a sample line of data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-rex-search-to-extract-a-string-between-two/m-p/188422#M54277</link>
      <description>&lt;P&gt;message:Receiving exposure from: net.tcp:\/\/URL\/Expsr\/Exp for account(s): 8568&lt;BR /&gt;
How would extract account number with rex&lt;/P&gt;

&lt;P&gt;Tried this but didn't bring any result.&lt;/P&gt;

&lt;P&gt;| rex field=_raw "Exp for account(s):\s+(?[^,]+)" &lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 16:37:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-rex-search-to-extract-a-string-between-two/m-p/188422#M54277</guid>
      <dc:creator>swetasoneji</dc:creator>
      <dc:date>2018-04-18T16:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my rex search to extract a string between two other strings from a sample line of data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-rex-search-to-extract-a-string-between-two/m-p/188423#M54278</link>
      <description>&lt;P&gt;Try&lt;/P&gt;

&lt;P&gt;| makeresults &lt;BR /&gt;
| eval xx ="net.tcp:\/\/URL\/Expsr\/Exp for account(s): 8568"&lt;BR /&gt;
| rex field=xx "Exp for account(s):\s+(?\d+)"&lt;/P&gt;

&lt;P&gt;you have to escape the braces with \ and add a match field name (number)&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 20:46:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-rex-search-to-extract-a-string-between-two/m-p/188423#M54278</guid>
      <dc:creator>FritzWittwer_ol</dc:creator>
      <dc:date>2018-04-18T20:46:48Z</dc:date>
    </item>
  </channel>
</rss>

