<?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 Issue using Rex command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614108#M213415</link>
    <description>&lt;P&gt;The full event is as follows:&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;1&lt;/SPAN&gt;,&lt;SPAN class=""&gt;2022/09/22&lt;/SPAN&gt; &lt;SPAN class=""&gt;10:01:40&lt;/SPAN&gt;,&lt;SPAN class=""&gt;013101004778&lt;/SPAN&gt;,&lt;SPAN class=""&gt;SYSTEM&lt;/SPAN&gt;,&lt;SPAN class=""&gt;general&lt;/SPAN&gt;,&lt;SPAN class=""&gt;2561&lt;/SPAN&gt;,&lt;SPAN class=""&gt;2022/09/22&lt;/SPAN&gt; &lt;SPAN class=""&gt;10:01:40&lt;/SPAN&gt;,,&lt;SPAN class=""&gt;general&lt;/SPAN&gt;,,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;general&lt;/SPAN&gt;,&lt;SPAN class=""&gt;informational&lt;/SPAN&gt;,"&lt;SPAN class=""&gt;Panorama&lt;/SPAN&gt; &lt;SPAN class=""&gt;push&lt;/SPAN&gt; &lt;SPAN class=""&gt;device-group&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;APCC1_Core_Controller&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;with&lt;/SPAN&gt; &lt;SPAN class=""&gt;merge-with-candidate-cfg&lt;/SPAN&gt; &lt;SPAN class=""&gt;flags&lt;/SPAN&gt; &lt;SPAN class=""&gt;set.JobId=60265.User=Panorama-admjeen_yeong_choong.&lt;/SPAN&gt; &lt;SPAN class=""&gt;Dequeue&lt;/SPAN&gt; &lt;SPAN class=""&gt;time=2022/09/22&lt;/SPAN&gt; &lt;SPAN class=""&gt;10:01:39.&lt;/SPAN&gt; &lt;SPAN class=""&gt;DG&lt;/SPAN&gt; &lt;SPAN class=""&gt;version:&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;APCC1_Core_Controller&lt;/SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;11854.&lt;/SPAN&gt; ",&lt;SPAN class=""&gt;7136408369296042839&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0x8000000000000000&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,,&lt;SPAN class=""&gt;apcc1pafwcc01&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;2022-09-22T10:01:40.203&lt;/SPAN&gt;+&lt;SPAN class=""&gt;00:00&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 22 Sep 2022 12:04:21 GMT</pubDate>
    <dc:creator>POR160893</dc:creator>
    <dc:date>2022-09-22T12:04:21Z</dc:date>
    <item>
      <title>Regex Issue using Rex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614098#M213406</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have a field X with values similar to the following "device-group APCC1_Core_Controller pre-rulebase application-override rules NFS-bypass UDP-1&lt;SPAN&gt;" and "device-group APCC1_Core_Controller pre-rulebase application-override rules" as 2 examples of possible values.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;I need to extract the value in between "device_group" and "per_rulebase...." and assign this as Y.&lt;BR /&gt;So, if X = "device-group APCC1_Core_Controller pre-rulebase application-override rules NFS-bypass UDP-1"&lt;BR /&gt;=&amp;gt; Y = "APCC1_Core_Controller"&lt;BR /&gt;&lt;BR /&gt;If X = "&lt;SPAN&gt;device-group APCC1_Core_Controller pre-rulebase application-override rules"&lt;BR /&gt;&lt;/SPAN&gt;=&amp;gt; Y = "&lt;SPAN&gt;APCC1_Core_Controller".&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;What would the rex command be???&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 15:23:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614098#M213406</guid>
      <dc:creator>POR160893</dc:creator>
      <dc:date>2022-09-22T15:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Issue using Rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614102#M213409</link>
      <description>&lt;P&gt;1. What have you tried yourself?&lt;/P&gt;&lt;P&gt;2. Can you provide the full event so that I can make an example for you.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 11:55:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614102#M213409</guid>
      <dc:creator>Azeemering</dc:creator>
      <dc:date>2022-09-22T11:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Issue using Rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614108#M213415</link>
      <description>&lt;P&gt;The full event is as follows:&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;1&lt;/SPAN&gt;,&lt;SPAN class=""&gt;2022/09/22&lt;/SPAN&gt; &lt;SPAN class=""&gt;10:01:40&lt;/SPAN&gt;,&lt;SPAN class=""&gt;013101004778&lt;/SPAN&gt;,&lt;SPAN class=""&gt;SYSTEM&lt;/SPAN&gt;,&lt;SPAN class=""&gt;general&lt;/SPAN&gt;,&lt;SPAN class=""&gt;2561&lt;/SPAN&gt;,&lt;SPAN class=""&gt;2022/09/22&lt;/SPAN&gt; &lt;SPAN class=""&gt;10:01:40&lt;/SPAN&gt;,,&lt;SPAN class=""&gt;general&lt;/SPAN&gt;,,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;general&lt;/SPAN&gt;,&lt;SPAN class=""&gt;informational&lt;/SPAN&gt;,"&lt;SPAN class=""&gt;Panorama&lt;/SPAN&gt; &lt;SPAN class=""&gt;push&lt;/SPAN&gt; &lt;SPAN class=""&gt;device-group&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;APCC1_Core_Controller&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class=""&gt;with&lt;/SPAN&gt; &lt;SPAN class=""&gt;merge-with-candidate-cfg&lt;/SPAN&gt; &lt;SPAN class=""&gt;flags&lt;/SPAN&gt; &lt;SPAN class=""&gt;set.JobId=60265.User=Panorama-admjeen_yeong_choong.&lt;/SPAN&gt; &lt;SPAN class=""&gt;Dequeue&lt;/SPAN&gt; &lt;SPAN class=""&gt;time=2022/09/22&lt;/SPAN&gt; &lt;SPAN class=""&gt;10:01:39.&lt;/SPAN&gt; &lt;SPAN class=""&gt;DG&lt;/SPAN&gt; &lt;SPAN class=""&gt;version:&lt;/SPAN&gt; &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;APCC1_Core_Controller&lt;/SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN class=""&gt;11854.&lt;/SPAN&gt; ",&lt;SPAN class=""&gt;7136408369296042839&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0x8000000000000000&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,,&lt;SPAN class=""&gt;apcc1pafwcc01&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;2022-09-22T10:01:40.203&lt;/SPAN&gt;+&lt;SPAN class=""&gt;00:00&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 22 Sep 2022 12:04:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614108#M213415</guid>
      <dc:creator>POR160893</dc:creator>
      <dc:date>2022-09-22T12:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Issue using Rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614194#M213437</link>
      <description>&lt;BLOCKQUOTE&gt;extract the value in between "device_group" and "&lt;FONT color="#FF6600"&gt;per&lt;/FONT&gt;_rulebase...." and assign this as Y&lt;/BLOCKQUOTE&gt;&lt;P&gt;I speculate that "&lt;EM&gt;&lt;FONT color="#FF6600"&gt;per&lt;/FONT&gt;&lt;/EM&gt;_rulebase" is a mistype for "&lt;EM&gt;&lt;FONT color="#FF6600"&gt;pre&lt;/FONT&gt;&lt;/EM&gt;_rulebase" as mentioned elsewhere in the OP. &amp;nbsp;The problem is that this "pre_rulebase" or "per_rulebase" does not seem to be a literal string, according to the sample event; it appears to be an application/industry specific term related to this source, something like "&lt;SPAN class=""&gt;with&lt;/SPAN&gt; &lt;SPAN class=""&gt;merge-with-candidate-cfg&lt;/SPAN&gt; &lt;SPAN class=""&gt;flags"&lt;/SPAN&gt;. &amp;nbsp;If this correct, you cannot expect people in a Splunk forum to intuit what "pre_rulebase" (or per_rulebase) stands for.&lt;/P&gt;&lt;P&gt;On superficial observation, the "Y" you are trying to extract is really just the name of device group. &amp;nbsp;If this name cannot contain spaces, you can simply do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "device_group (?&amp;lt;device_group&amp;gt;\S+)"&lt;/LI-CODE&gt;&lt;P&gt;If the name may contain space, but the "pre_rulebase" always begins with keyword "with" as exemplified in the sample event, you can do something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "device_group (?&amp;lt;device_group&amp;gt;.+) with "&lt;/LI-CODE&gt;&lt;P&gt;Of course, this second form has a larger chance of overreaching because the word "with" may appear in some other content of the event. &amp;nbsp;You have to find some pattern to reduce such chances.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 18:15:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614194#M213437</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-09-22T18:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Issue using Rex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614307#M213460</link>
      <description>&lt;P&gt;So, say I have a field called "M" and some of the values are as follows:&lt;BR /&gt;&lt;BR /&gt;"Panorama push to device:013101010578 for device-group: Durham_IPV6_INET_SVCS succeeded. JobId=2480530"&lt;BR /&gt;&lt;BR /&gt;"Panorama push to device:007257000068919 for device-group: Azure-China-Internet-North succeeded. JobId=2480524"&lt;BR /&gt;&lt;BR /&gt;"Panorama push to device:016401009013 for device-group: Austin_Experience_Lounge succeeded. JobId=2480530"&lt;BR /&gt;&lt;BR /&gt;How can I extract just the first string in between each "....device-group: *** succeeded. ....", where *** represents the respective value to be extracted. In the case of the above 3 examples, the 3 values extracted are "Durham_IPV6_INET_SVCS", "Azure-China-Internet-North" and "Austin_Experience_Lounge" respectively.&lt;BR /&gt;&lt;BR /&gt;I tried using the following Splunk command but got no success&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;:&lt;BR /&gt;|rex "body\s(?&amp;lt;portNumber&amp;gt;\d+)\s"&lt;BR /&gt;&lt;BR /&gt;Can you please help?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 13:08:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614307#M213460</guid>
      <dc:creator>POR160893</dc:creator>
      <dc:date>2022-09-23T13:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Issue using Rex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614308#M213461</link>
      <description>&lt;P&gt;So, say I have a field called "M" and some of the values are as follows:&lt;BR /&gt;&lt;BR /&gt;"Panorama push to device:013101010578 for device-group: Durham_IPV6_INET_SVCS succeeded. JobId=2480530"&lt;BR /&gt;&lt;BR /&gt;"Panorama push to device:007257000068919 for device-group: Azure-China-Internet-North succeeded. JobId=2480524"&lt;BR /&gt;&lt;BR /&gt;"Panorama push to device:016401009013 for device-group: Austin_Experience_Lounge succeeded. JobId=2480530"&lt;BR /&gt;&lt;BR /&gt;How can I extract just the first string in between each "....device-group: *** succeeded. ....", where *** represents the respective value to be extracted. In the case of the above 3 examples, the 3 values extracted are "Durham_IPV6_INET_SVCS", "Azure-China-Internet-North" and "Austin_Experience_Lounge" respectively.&lt;BR /&gt;&lt;BR /&gt;I tried using the following Splunk command but got no success&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;:&lt;BR /&gt;|rex "body\s(?&amp;lt;portNumber&amp;gt;\d+)\s"&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Any help?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 13:08:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614308#M213461</guid>
      <dc:creator>POR160893</dc:creator>
      <dc:date>2022-09-23T13:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Issue using Rex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614322#M213470</link>
      <description>&lt;P&gt;At the moment, I have got this far:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="POR160893_0-1663941502560.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21642iC3441951CF89F0FA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="POR160893_0-1663941502560.png" alt="POR160893_0-1663941502560.png" /&gt;&lt;/span&gt;&lt;BR /&gt;However, I do not want to have "device-group:" included as part of the values.&lt;BR /&gt;How can I change my regex?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 13:59:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614322#M213470</guid>
      <dc:creator>POR160893</dc:creator>
      <dc:date>2022-09-23T13:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Issue using Rex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614355#M213482</link>
      <description>&lt;P&gt;If you don't want device-group, don't include it in the parenthesis. &amp;nbsp;Also, \w is incorrect for your data because your group name often includes dashes as illustrated. &amp;nbsp;See my other post.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "device-group (?&amp;lt;device_group&amp;gt;\S+)"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 23 Sep 2022 17:07:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614355#M213482</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-09-23T17:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Issue using Rex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614357#M213484</link>
      <description>&lt;P&gt;&lt;A href="https://regex101.com/r/9NVsvf/2" target="_blank"&gt;regex101: build, test, and debug regex&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Please take a look at this link.&amp;nbsp; I suggestion use regex101 before put them into splunk.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 17:45:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614357#M213484</guid>
      <dc:creator>youngsuh</dc:creator>
      <dc:date>2022-09-23T17:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Issue using Rex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614359#M213485</link>
      <description>&lt;P&gt;Ok, there's a colon after "device-group". &amp;nbsp;So add that.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "device-group: (?&amp;lt;device_group&amp;gt;\S+)"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 23 Sep 2022 17:30:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Issue-using-Rex-command/m-p/614359#M213485</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-09-23T17:30:19Z</dc:date>
    </item>
  </channel>
</rss>

