<?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 Rex to match fields until particular string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-match-fields-until-particular-string/m-p/491384#M137170</link>
    <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I'm using expression:  &lt;EM&gt;(?ms)book.(?\d{7}-\d)&lt;/EM&gt; to extract some numbers from this input (thanks @to4kawa ) :&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;" new contributors: Set(book.1272473-1, book.1272472-1, book.1272477-1), removed contributors: Set(book.1271398-1, book.1271397-1)".&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;This gives me all 5 numbers (1272473, 1272472, 1272477, 1271398, 1271397), but I'm interested only in numbers before keyword "removed" (1272473, 1272472, 1272477). Please bear in mind, there could be from 1 to 5 strings in "new contribution" section and I would like to extract all of them. &lt;/P&gt;

&lt;P&gt;Thanks is advance,&lt;BR /&gt;
Szymon&lt;/P&gt;</description>
    <pubDate>Tue, 05 May 2020 15:31:01 GMT</pubDate>
    <dc:creator>slipinski</dc:creator>
    <dc:date>2020-05-05T15:31:01Z</dc:date>
    <item>
      <title>Rex to match fields until particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-match-fields-until-particular-string/m-p/491384#M137170</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I'm using expression:  &lt;EM&gt;(?ms)book.(?\d{7}-\d)&lt;/EM&gt; to extract some numbers from this input (thanks @to4kawa ) :&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;" new contributors: Set(book.1272473-1, book.1272472-1, book.1272477-1), removed contributors: Set(book.1271398-1, book.1271397-1)".&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;This gives me all 5 numbers (1272473, 1272472, 1272477, 1271398, 1271397), but I'm interested only in numbers before keyword "removed" (1272473, 1272472, 1272477). Please bear in mind, there could be from 1 to 5 strings in "new contribution" section and I would like to extract all of them. &lt;/P&gt;

&lt;P&gt;Thanks is advance,&lt;BR /&gt;
Szymon&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 15:31:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-to-match-fields-until-particular-string/m-p/491384#M137170</guid>
      <dc:creator>slipinski</dc:creator>
      <dc:date>2020-05-05T15:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Rex to match fields until particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-match-fields-until-particular-string/m-p/491385#M137171</link>
      <description>&lt;P&gt;UPDATE:&lt;BR /&gt;
use 2 &lt;CODE&gt;rex&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="new contributors: Set(book.1272473-1, book.1272472-1, book.1272477-1), removed contributors: Set(book.1271398-1, book.1271397-1)" 
| rex "(?&amp;lt;new&amp;gt;.*), removed" 
| rex field=new max_match=0 "(?ms)book.(?&amp;lt;book&amp;gt;\d{7}-\d)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 May 2020 15:50:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-to-match-fields-until-particular-string/m-p/491385#M137171</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-05-05T15:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Rex to match fields until particular string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-match-fields-until-particular-string/m-p/491386#M137172</link>
      <description>&lt;P&gt;Correct me if I'm wrong, but your query will extract fields after "removed" string and I would like to extract fields before it.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 18:05:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-to-match-fields-until-particular-string/m-p/491386#M137172</guid>
      <dc:creator>slipinski</dc:creator>
      <dc:date>2020-05-05T18:05:06Z</dc:date>
    </item>
  </channel>
</rss>

