<?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: How do you extract fields that end with a question? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396771#M115209</link>
    <description>&lt;P&gt;When you want to escape special characters like quotes and questionmarks, you need to do that using a &lt;CODE&gt;\&lt;/CODE&gt; not a &lt;CODE&gt;/&lt;/CODE&gt;. Anyway no need to escape that questionmark in that location in the regex. You also need to add a &lt;CODE&gt;+&lt;/CODE&gt; to make it match multple non-? characters.&lt;/P&gt;

&lt;P&gt;Try this: &lt;CODE&gt;rex field = api_call "\"(?&amp;lt;field1&amp;gt;[^?]+)"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/zaolbY/1"&gt;https://regex101.com/r/zaolbY/1&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Feb 2019 10:04:56 GMT</pubDate>
    <dc:creator>FrankVl</dc:creator>
    <dc:date>2019-02-25T10:04:56Z</dc:date>
    <item>
      <title>How do you extract fields that end with a question?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396770#M115208</link>
      <description>&lt;P&gt;I wanted to extract a field to capture the data before the question mark as below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;api_call "Get \search\ip\6789\?=number\90"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;where api_call is an already extracted field.&lt;/P&gt;

&lt;P&gt;I wrote it as a rex field = &lt;CODE&gt;api_call "/"(?[^/?])"&lt;/CODE&gt;   ---- result required is Get \search\ip\6789\&lt;BR /&gt;
 but it doesn't seem to work. &lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 09:58:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396770#M115208</guid>
      <dc:creator>Deepz2612</dc:creator>
      <dc:date>2019-02-25T09:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract fields that end with a question?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396771#M115209</link>
      <description>&lt;P&gt;When you want to escape special characters like quotes and questionmarks, you need to do that using a &lt;CODE&gt;\&lt;/CODE&gt; not a &lt;CODE&gt;/&lt;/CODE&gt;. Anyway no need to escape that questionmark in that location in the regex. You also need to add a &lt;CODE&gt;+&lt;/CODE&gt; to make it match multple non-? characters.&lt;/P&gt;

&lt;P&gt;Try this: &lt;CODE&gt;rex field = api_call "\"(?&amp;lt;field1&amp;gt;[^?]+)"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/zaolbY/1"&gt;https://regex101.com/r/zaolbY/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 10:04:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396771#M115209</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-02-25T10:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract fields that end with a question?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396772#M115210</link>
      <description>&lt;P&gt;Hi @Deepz2612&lt;/P&gt;

&lt;P&gt;I have tried this regex for extracting the field messsage. (it worked with regex101.com)&lt;BR /&gt;
&lt;CODE&gt;\"(?&amp;lt;message&amp;gt;\w+\s\S+)\?&lt;/CODE&gt;`&lt;/P&gt;

&lt;P&gt;wit rex it should look like this:&lt;BR /&gt;
&lt;CODE&gt;rex field=api_call "\"(?&amp;lt;message&amp;gt;\w+\s\S+)\?"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 10:11:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396772#M115210</guid>
      <dc:creator>markusspitzli</dc:creator>
      <dc:date>2019-02-25T10:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract fields that end with a question?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396773#M115211</link>
      <description>&lt;P&gt;Hi @Deepz2612&lt;/P&gt;

&lt;P&gt;Please try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval api_call= "Get \search\ip\6789\?=number\90" 
| rex field=api_call "(?P&amp;lt;result&amp;gt;.*)\?="
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Feb 2019 15:40:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396773#M115211</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-02-25T15:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract fields that end with a question?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396774#M115212</link>
      <description>&lt;P&gt;Using &lt;CODE&gt;.*&lt;/CODE&gt; should be avoided where possible (as it triggers excessive matching and backtracking) and in this case there is no need for it. (in this tiny example, it causes 30 steps to complete according to regex101, compared to 9 for my solution).&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 16:40:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396774#M115212</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-02-25T16:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract fields that end with a question?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396775#M115213</link>
      <description>&lt;P&gt;Using &lt;CODE&gt;\S+&lt;/CODE&gt; is not very efficient (as it includes the ? and will require backtracking to get the actual match). And in this case there is no need for it. (in this tiny example, it causes 32 steps to complete according to regex101, compared to 9 for my solution).&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 16:41:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396775#M115213</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-02-25T16:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract fields that end with a question?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396776#M115214</link>
      <description>&lt;P&gt;This works:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval foo= "Get \search\ip\6789\?=number\90"
| rex field=foo "(?&amp;lt;api_call&amp;gt;[^\?]+)\?"
| table api_call foo

api_call                foo
Get \search\ip\6789\    Get \search\ip\6789\?=number\90
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Mar 2019 00:27:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-extract-fields-that-end-with-a-question/m-p/396776#M115214</guid>
      <dc:creator>wrangler2x</dc:creator>
      <dc:date>2019-03-01T00:27:39Z</dc:date>
    </item>
  </channel>
</rss>

