<?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: regex not working propoerly in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/regex-not-working-propoerly/m-p/419506#M168529</link>
    <description>&lt;P&gt;Use &lt;CODE&gt;rex&lt;/CODE&gt; instead, test it with this run everywhere example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval foo="/api/v1/user/abc/xyz/24966700::2?personalizationChannel=ADVISOR_CENTER" 
| rex field=foo "(?&amp;lt;MyNewField&amp;gt;\/[^?]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the field &lt;CODE&gt;MyNewField&lt;/CODE&gt; has the value of &lt;CODE&gt;/api/v1/user/abc/xyz/24966700::2&lt;/CODE&gt; in this example.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jul 2018 00:36:20 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2018-07-04T00:36:20Z</dc:date>
    <item>
      <title>regex not working propoerly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-not-working-propoerly/m-p/419503#M168526</link>
      <description>&lt;P&gt;/api/v1/user/engines/forecast/xyz?abc=true&lt;/P&gt;

&lt;P&gt;For the above URL, I want to display the URL in the table till xyz (/api/v1/user/engines/forecast/xyz). &lt;BR /&gt;
I am using the following regex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| regex requestURI = _raw "/[^?]*/"                                // not include data after ?
| regex requestURI = ".*[^.txt]$"                                     // no .txt extensions in the URI
| regex requestURI = "/[0-9a-zA-Z]{3,}/"                         // minimum length should be 3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But the first one is not working and the whole URL is being displayed&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 22:09:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-not-working-propoerly/m-p/419503#M168526</guid>
      <dc:creator>prannoy93singh</dc:creator>
      <dc:date>2018-07-03T22:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: regex not working propoerly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-not-working-propoerly/m-p/419504#M168527</link>
      <description>&lt;P&gt;Hi prannoy93singh,&lt;/P&gt;

&lt;P&gt;to match &lt;CODE&gt;/&lt;/CODE&gt; you need to escape them in the regex, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; \/[^?]+
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 22:13:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-not-working-propoerly/m-p/419504#M168527</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-07-03T22:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: regex not working propoerly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-not-working-propoerly/m-p/419505#M168528</link>
      <description>&lt;P&gt;I tried running the above query, but it is still not giving the desired result.&lt;/P&gt;

&lt;P&gt;/api/v1/user/abc/xyz/24966700::2?personalizationChannel=ADVISOR_CENTER&lt;/P&gt;

&lt;P&gt;such queries are still showing &lt;/P&gt;</description>
      <pubDate>Tue, 03 Jul 2018 22:43:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-not-working-propoerly/m-p/419505#M168528</guid>
      <dc:creator>prannoy93singh</dc:creator>
      <dc:date>2018-07-03T22:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: regex not working propoerly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-not-working-propoerly/m-p/419506#M168529</link>
      <description>&lt;P&gt;Use &lt;CODE&gt;rex&lt;/CODE&gt; instead, test it with this run everywhere example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval foo="/api/v1/user/abc/xyz/24966700::2?personalizationChannel=ADVISOR_CENTER" 
| rex field=foo "(?&amp;lt;MyNewField&amp;gt;\/[^?]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the field &lt;CODE&gt;MyNewField&lt;/CODE&gt; has the value of &lt;CODE&gt;/api/v1/user/abc/xyz/24966700::2&lt;/CODE&gt; in this example.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jul 2018 00:36:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-not-working-propoerly/m-p/419506#M168529</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2018-07-04T00:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: regex not working propoerly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-not-working-propoerly/m-p/419507#M168530</link>
      <description>&lt;P&gt;You are confusing &lt;CODE&gt;regex&lt;/CODE&gt; with &lt;CODE&gt;rex&lt;/CODE&gt;.  Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval _raw="/api/v1/user/engines/forecast/xyz?abc=true"
| rex "^(?&amp;lt;requestURI1&amp;gt;/[^?]*/)"
| rex "(?&amp;lt;requestURI2&amp;gt;.*[^.txt])$"
| rex "(?&amp;lt;requestURI3&amp;gt;/[0-9a-zA-Z]{3,}/)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Jul 2018 01:35:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-not-working-propoerly/m-p/419507#M168530</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-04T01:35:05Z</dc:date>
    </item>
  </channel>
</rss>

