<?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: Tricky regex in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Tricky-regex/m-p/367734#M5990</link>
    <description>&lt;P&gt;If you post the regex that correctly gets the number, then this would be easier to be completely right.  You are going to add this on the end of that regex, inside your quotes...  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\/(?&amp;lt;function&amp;gt;[^?\d\/]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above translates as, match one slash, and then take at least one character made up of anything that is not a question mark, whitespace, or a slash and put it into the variable called &lt;CODE&gt;function&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;I believe the whole thing will look like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\/rest\/icontrol\/sites\/(?&amp;lt;number&amp;gt;\d+)\/(?&amp;lt;function&amp;gt;[^?\d\/]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 27 Sep 2017 18:16:43 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-09-27T18:16:43Z</dc:date>
    <item>
      <title>Tricky regex</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Tricky-regex/m-p/367733#M5989</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have this data&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;10.210.192.5 - - [26/Sep/2017:19:59:59 -0400] "POST /rest/icontrol/sites/266646/decreaseWatchCount HTTP/1.1" 200 - "-" "Mozilla/5.0 (Linux; Android 7.1.1; XT1635-01 Build/NDNS26.118-23-1; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/61.0.3163.98 Mobile Safari/537.36" "-"  "-"


10.210.192.15 - - [26/Sep/2017:19:59:59 -0400] "GET /rest/icontrol/sites/236039/eventsByDay?startDate=2017-09-25&amp;amp;endDate=2017-09-25&amp;amp;maxResults=65536 HTTP/1.1" 200 68785 "https://portal.coxhomelife.com/sp/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36" "-"  "-"

10.210.192.5 - - [26/Sep/2017:19:59:59 -0400] "GET /rest/icontrol/sites/267452/fetchImage?imageId=5222117165&amp;amp;imageType=image HTTP/1.1" 200 187081 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60" "-"  "-"


10.210.192.15 - - [26/Sep/2017:19:59:59 -0400] "POST /rest/icontrol/sites/315568/network/instances/100876ffe9572a.0/functions/disarm HTTP/1.1" 202 9 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60" "-"  "-"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to be able to get the number (266646, 236039, 267452 already have regex for this) and the function.  The function is the tricky one.  Based on this data the functions would be:&lt;/P&gt;

&lt;P&gt;decreaseWatchCount&lt;BR /&gt;
eventsByDay&lt;BR /&gt;
fetchImage&lt;BR /&gt;
network&lt;/P&gt;

&lt;P&gt;I've tried everything I can think of but I can't seem to find a way to be successful on all the different function formats.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 17:24:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Tricky-regex/m-p/367733#M5989</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2017-09-27T17:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky regex</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Tricky-regex/m-p/367734#M5990</link>
      <description>&lt;P&gt;If you post the regex that correctly gets the number, then this would be easier to be completely right.  You are going to add this on the end of that regex, inside your quotes...  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\/(?&amp;lt;function&amp;gt;[^?\d\/]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above translates as, match one slash, and then take at least one character made up of anything that is not a question mark, whitespace, or a slash and put it into the variable called &lt;CODE&gt;function&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;I believe the whole thing will look like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\/rest\/icontrol\/sites\/(?&amp;lt;number&amp;gt;\d+)\/(?&amp;lt;function&amp;gt;[^?\d\/]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Sep 2017 18:16:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Tricky-regex/m-p/367734#M5990</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-27T18:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Tricky regex</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Tricky-regex/m-p/367735#M5991</link>
      <description>&lt;P&gt;Hi DalJeanis,&lt;/P&gt;

&lt;P&gt;THANK YOU!!!  That worked perfectly!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 18:33:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Tricky-regex/m-p/367735#M5991</guid>
      <dc:creator>dbcase</dc:creator>
      <dc:date>2017-09-27T18:33:51Z</dc:date>
    </item>
  </channel>
</rss>

