<?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: Is it possible to use an extracted field inside a regex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162733#M46190</link>
    <description>&lt;P&gt;ok. I'm going to give it a try.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Apr 2015 15:59:00 GMT</pubDate>
    <dc:creator>edrivera3</dc:creator>
    <dc:date>2015-04-22T15:59:00Z</dc:date>
    <item>
      <title>Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162722#M46179</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;I already extracted a field (block_num) in my event, but now I would like to use it as part of a new regex. I want to do something like this:&lt;BR /&gt;
&lt;CODE&gt;...| rex field=_raw " Block number block_num (? &amp;lt; block_info&amp;gt;\w{1,}?)"&lt;/CODE&gt; ---- where block_num is the field I already have.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:39:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162722#M46179</guid>
      <dc:creator>edrivera3</dc:creator>
      <dc:date>2020-09-28T19:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162723#M46180</link>
      <description>&lt;P&gt;Before the w there is a back slash. &lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 15:05:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162723#M46180</guid>
      <dc:creator>edrivera3</dc:creator>
      <dc:date>2015-04-22T15:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162724#M46181</link>
      <description>&lt;P&gt;I already tried enclosing the block_num in [ ] or in  $$.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 15:20:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162724#M46181</guid>
      <dc:creator>edrivera3</dc:creator>
      <dc:date>2015-04-22T15:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162725#M46182</link>
      <description>&lt;P&gt;No No No !&lt;BR /&gt;
By writing  &lt;CODE&gt;...| rex field=_raw " Block number block_num (? &amp;lt; block_info&amp;gt;\w{1,}?)"&lt;/CODE&gt;, your are telling splunk to search for a word which is after the group of words &lt;CODE&gt;Block number block_num&lt;/CODE&gt;. Splunk will not take &lt;STRONG&gt;block_num&lt;/STRONG&gt; here as a field. &lt;BR /&gt;
So i am not sure that what you want is yet possible.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 15:21:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162725#M46182</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-04-22T15:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162726#M46183</link>
      <description>&lt;P&gt;Are these things in the same event? What does an event look like?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 15:23:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162726#M46183</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2015-04-22T15:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162727#M46184</link>
      <description>&lt;P&gt;I know the regex is wrong, I would like to know if there is a way to do it. &lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 15:25:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162727#M46184</guid>
      <dc:creator>edrivera3</dc:creator>
      <dc:date>2015-04-22T15:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162728#M46185</link>
      <description>&lt;P&gt;No! you can only take &lt;STRONG&gt;block_num&lt;/STRONG&gt;  as a word inside the regex. Let me know &lt;STRONG&gt;block_num&lt;/STRONG&gt; values, i think i can help you extract &lt;STRONG&gt;block_info&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 15:35:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162728#M46185</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-04-22T15:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162729#M46186</link>
      <description>&lt;P&gt;Yes, they are in the same event. The event is quite a long and mostly a text. The structure of the events are like:&lt;BR /&gt;
block number 500&lt;BR /&gt;
... info (sometimes there are errors here)&lt;BR /&gt;
.... info&lt;BR /&gt;
End of block number&lt;BR /&gt;
block number 501&lt;BR /&gt;
....info&lt;BR /&gt;
...info&lt;BR /&gt;
End of block number 501&lt;BR /&gt;
First I extract the error, then the block number where the error is, and finally I want to extract the whole block. Well... that's the idea.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 15:37:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162729#M46186</guid>
      <dc:creator>edrivera3</dc:creator>
      <dc:date>2015-04-22T15:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162730#M46187</link>
      <description>&lt;P&gt;Try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| rex field=_raw " Block number ".block_num." (?P&amp;lt;block_info&amp;gt;\w{1,}?)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Apr 2015 15:43:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162730#M46187</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-04-22T15:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162731#M46188</link>
      <description>&lt;P&gt;It looks like you're doing that inside out. Why not extract all the blocks first, and then filter your results based on whether there's an error in the block or not?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 15:47:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162731#M46188</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2015-04-22T15:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162732#M46189</link>
      <description>&lt;P&gt;It is a 3-5 digit number.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 15:54:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162732#M46189</guid>
      <dc:creator>edrivera3</dc:creator>
      <dc:date>2015-04-22T15:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162733#M46190</link>
      <description>&lt;P&gt;ok. I'm going to give it a try.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 15:59:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162733#M46190</guid>
      <dc:creator>edrivera3</dc:creator>
      <dc:date>2015-04-22T15:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162734#M46191</link>
      <description>&lt;P&gt;I extracted all blocks, but how I search for an error inside each block text.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 16:07:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162734#M46191</guid>
      <dc:creator>edrivera3</dc:creator>
      <dc:date>2015-04-22T16:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162735#M46192</link>
      <description>&lt;P&gt;Use whatever error-finding regex you were using before on each block.&lt;/P&gt;

&lt;P&gt;Alternatively, you can try to extract both at once:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "Block number (?&amp;lt;block_num&amp;gt;\d+)(.*)[YOUR ERROR-EXTRACTING REGEX GOES HERE](.*)End of block number"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Apr 2015 16:11:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162735#M46192</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2015-04-22T16:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162736#M46193</link>
      <description>&lt;P&gt;But you are only extracting the block_num which I already have. &lt;/P&gt;

&lt;P&gt;About the alternative about using a error-finding regex after I extracted all blocks. How can I use a regex to look inside field values?&lt;/P&gt;

&lt;P&gt;The following doesn't work because the block info is several lines, not only an error number:&lt;BR /&gt;
 ...|search block_info="ERROR" &lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 16:19:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162736#M46193</guid>
      <dc:creator>edrivera3</dc:creator>
      <dc:date>2015-04-22T16:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162737#M46194</link>
      <description>&lt;P&gt;I think these are some of the options that I am looking for: &lt;/P&gt;

&lt;P&gt;(1) a way to use a extracted field inside a regex&lt;/P&gt;

&lt;P&gt;(2) If I extract all blocks in the event, is there is a way to look inside the field value to find if there is an error inside the block. Please consider that the field value is a string with several lines that include the word "ERROR". &lt;/P&gt;

&lt;P&gt;(3) Is there is a way to use regex for looking for a word and extract some lines that are before it and after including the word? &lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 16:53:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162737#M46194</guid>
      <dc:creator>edrivera3</dc:creator>
      <dc:date>2015-04-22T16:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162738#M46195</link>
      <description>&lt;P&gt;For #1, see my answer.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 17:12:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162738#M46195</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-04-22T17:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162739#M46196</link>
      <description>&lt;P&gt;I  tried that but I encountered an error:&lt;BR /&gt;
Error in 'rex' command: Encountered the following error while compiling the regex 'Block number block_num (?P&amp;lt;.block_info.&amp;gt;\w{1,}?)': Regex: syntax error in subpattern name (missing terminator)&lt;/P&gt;

&lt;P&gt;This is my regex:&lt;BR /&gt;
 ...| rex field=_raw "Block number block_num (?P&amp;lt;".block_info."&amp;gt;\w{1,}?)"&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:39:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162739#M46196</guid>
      <dc:creator>edrivera3</dc:creator>
      <dc:date>2020-09-28T19:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162740#M46197</link>
      <description>&lt;P&gt;I got no errors when I used concatenation in my rex command.  What version of Splunk are you using?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 17:42:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162740#M46197</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-04-22T17:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use an extracted field inside a regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162741#M46198</link>
      <description>&lt;P&gt;Version 6.2&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 17:44:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-use-an-extracted-field-inside-a-regex/m-p/162741#M46198</guid>
      <dc:creator>edrivera3</dc:creator>
      <dc:date>2015-04-22T17:44:10Z</dc:date>
    </item>
  </channel>
</rss>

