<?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 for ending with a particular pattern in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57401#M14020</link>
    <description>&lt;P&gt;Thank you for the detailed explanation. I will try this and let you know.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Sep 2013 13:04:48 GMT</pubDate>
    <dc:creator>xvxt006</dc:creator>
    <dc:date>2013-09-09T13:04:48Z</dc:date>
    <item>
      <title>Regex for ending with a particular pattern</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57396#M14015</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am want to get all the events ending with a referrer url of the below format.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&lt;A href="http://www.company.com/product/Glasses-PR37323" target="test_blank"&gt;http://www.company.com/product/Glasses-PR37323&lt;/A&gt; 
&lt;A href="http://www.company.com/search?keyword=PR12389" target="test_blank"&gt;http://www.company.com/search?keyword=PR12389&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So i tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| regex Referrer=*PR\d{5}$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But did not work. Any suggestions please?&lt;/P&gt;</description>
      <pubDate>Sat, 07 Sep 2013 22:38:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57396#M14015</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2013-09-07T22:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for ending with a particular pattern</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57397#M14016</link>
      <description>&lt;P&gt;Hi xvxt006,&lt;/P&gt;

&lt;P&gt;Are you tring to do this via the search interface? If so, your syntax is incorrect. Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search&amp;gt; | rex "PR(?&amp;lt;referrer&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This assumes that:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;You do not have multilines event&lt;/LI&gt;
&lt;LI&gt;The referrer is &lt;STRONG&gt;always&lt;/STRONG&gt; preceded with &lt;CODE&gt;PR&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;The referrer ID is always numerical.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;The &lt;CODE&gt;regex&lt;/CODE&gt; command is used to remove or keep results that match the regular expression (i.e. not for field extraction).&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;References:&lt;/STRONG&gt;&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;CODE&gt;rex&lt;/CODE&gt; (Splunk docs): &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;CODE&gt;regex&lt;/CODE&gt; (Splunk docs): &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Regex"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Regex&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;If this answers your question don't forget to upvote and mark as answered so other people with the same issue can be helped as well &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Sep 2013 01:55:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57397#M14016</guid>
      <dc:creator>rturk</dc:creator>
      <dc:date>2013-09-08T01:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for ending with a particular pattern</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57398#M14017</link>
      <description>&lt;P&gt;You've got a couple of syntax errors there. You need double quotes around the regular expression, and your regular expression has a couple of problems. (also, that is an oddly non-traditional spelling for the fieldname, (although a proper spelling of the word)  so I would check on that to be sure...&lt;/P&gt;

&lt;P&gt;What you want is this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| regex Referrer = "PR\d{5}$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the regex command is a kind of a match for "keepit" or "don't keep it" so you don't have to try to accommodate the rest of the string. If it finds that pattern, in the field you specify, it will keep or not keep depending upon your operator. &lt;/P&gt;

&lt;P&gt;In this case, the asterisk isn't doing anything. &lt;/P&gt;

&lt;P&gt;In regular expressions it isn't really a "wildcard" character. It matches 0 or more of the preceding token.   so 87*  will match  877  but luckily in this case you don't have to worry about that.&lt;/P&gt;

&lt;P&gt;Now, without the asterisk, your regular expression is only looking for this: PRddddd.   You need to escape the d so that it means digit and it will repeat only that character. &lt;/P&gt;

&lt;P&gt;I think you'll be in business now.&lt;/P&gt;

&lt;P&gt;I highly recommend this website for testing out your regular expressions.&lt;BR /&gt;
Super helpful:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://gskinner.com/RegExr/"&gt;http://gskinner.com/RegExr/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Sep 2013 02:01:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57398#M14017</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2013-09-08T02:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for ending with a particular pattern</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57399#M14018</link>
      <description>&lt;P&gt;I don't think the question was about field extraction... but I guess we'll see. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Sep 2013 02:10:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57399#M14018</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2013-09-08T02:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for ending with a particular pattern</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57400#M14019</link>
      <description>&lt;P&gt;Ahhh you might be correct &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Sep 2013 02:12:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57400#M14019</guid>
      <dc:creator>rturk</dc:creator>
      <dc:date>2013-09-08T02:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for ending with a particular pattern</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57401#M14020</link>
      <description>&lt;P&gt;Thank you for the detailed explanation. I will try this and let you know.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2013 13:04:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57401#M14020</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2013-09-09T13:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for ending with a particular pattern</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57402#M14021</link>
      <description>&lt;P&gt;Yes it is not about filed extraction.. Thank you both for your inputs. Yes i will mark it once i test it.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2013 13:06:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57402#M14021</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2013-09-09T13:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Regex for ending with a particular pattern</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57403#M14022</link>
      <description>&lt;P&gt;I have asked this in a separate thread too. But just want to check with you guys to see if you can help me with this one too as it is similar.  &lt;/P&gt;

&lt;P&gt;I am planning to capture all the URIs with word chaser (case insensitive).&lt;/P&gt;

&lt;P&gt;I have used this&lt;BR /&gt;
| regex uri="(?i)Chaser(?:[^\"])"&lt;/P&gt;

&lt;P&gt;but did not get any results. do i need to include anything in the regex? &lt;BR /&gt;
Thanks for your help. &lt;/P&gt;

&lt;P&gt;Below are few examples. &lt;/P&gt;

&lt;P&gt;1) /gdfgfd/N-/Ntt-MILWAUKEEFUEL?pm_sp=CS_Chaser--PO_L3_Multi--werwerdfg&lt;/P&gt;

&lt;P&gt;2)/CHASER-STAKES-rOutdoor-brother-Retractable-6trJ3?we_sp=IO--PDI--RR_VTV70300505&amp;amp;cm_vc=WSPRRZ1&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:44:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-for-ending-with-a-particular-pattern/m-p/57403#M14022</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2020-09-28T14:44:28Z</dc:date>
    </item>
  </channel>
</rss>

