<?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: Help on REGEX match ignoring non-mandatory string at its end in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-on-REGEX-match-ignoring-non-mandatory-string-at-its-end/m-p/550264#M156145</link>
    <description>&lt;P&gt;something like this maybe?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;\((?&amp;lt;rule_name&amp;gt;.*?)(?:-00)?\)$&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 03 May 2021 19:24:54 GMT</pubDate>
    <dc:creator>maciep</dc:creator>
    <dc:date>2021-05-03T19:24:54Z</dc:date>
    <item>
      <title>Help on REGEX match ignoring non-mandatory string at its end</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-REGEX-match-ignoring-non-mandatory-string-at-its-end/m-p/550256#M156141</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;i searched few hours how to extract the RULE_NAME field from my Firewall logs without success.&lt;/P&gt;&lt;P&gt;RULE_NAME is at the end of the log line, between (). It can contain any characters, space, "-" or "_".&lt;/P&gt;&lt;P&gt;My problem comes from the fact that the RULE_NAME is sometimes finished by a 3 characters string i need to remove : "-00"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my actual REGEX, but it does't works for the simple "Internal Policy" RULE_NAME :&amp;nbsp;&lt;/P&gt;&lt;P&gt;.*\s+\((?P&amp;lt;RULE_NAME&amp;gt;.*)?(-00)\)$&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are original logs lines i need to match :&lt;/P&gt;&lt;P&gt;May 3 16:35:02 10.40.1.254 May 3 16:35:02 MYFIREWALL.mycorp.lan firewall: msg_id="3000-0148" Allow 0-SSL-VPN Firebox 73 udp 20 128 172.XXX.XXX.14 172.XXX.XXX.1 54127 53 src_user="fgi@mycorp.com" (DNS-01-proxy_user.out-00)&lt;BR /&gt;May 3 17:39:56 10.40.1.254 May 3 17:39:56 MYFIREWALL.mycorp.lan firewall: msg_id="3000-0148" Allow VLAN1-Lan-Trusted Firebox 69 udp 20 128 172.21.20.26 172.21.20.254 52481 53 msg="DNS Forwarding" src_user="yal@mycorp.lan" record_type="A" question="sync.srv.stackadapt.com" (Internal Policy)&lt;BR /&gt;May 3 16:35:02 10.40.1.254 May 3 16:35:02 MYFIREWALL.mycorp.lan firewall: msg_id="3000-0148" Allow 0-SSL-VPN Firebox 73 udp 20 128 172.XXX.XXX.14 172.XXX.XXX.1 54127 53 src_user="fgi@mycorp.com" (My super rule name with space DNS.out)&lt;/P&gt;&lt;P&gt;Any idea on how to ignore the "-00" suffix when present ?&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Florent&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 17:57:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-REGEX-match-ignoring-non-mandatory-string-at-its-end/m-p/550256#M156141</guid>
      <dc:creator>Flo-Paris</dc:creator>
      <dc:date>2021-05-03T17:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help on REGEX match ignoring non-mandatory string at its end</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-REGEX-match-ignoring-non-mandatory-string-at-its-end/m-p/550264#M156145</link>
      <description>&lt;P&gt;something like this maybe?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;\((?&amp;lt;rule_name&amp;gt;.*?)(?:-00)?\)$&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 03 May 2021 19:24:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-REGEX-match-ignoring-non-mandatory-string-at-its-end/m-p/550264#M156145</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2021-05-03T19:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help on REGEX match ignoring non-mandatory string at its end</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-REGEX-match-ignoring-non-mandatory-string-at-its-end/m-p/550270#M156148</link>
      <description>&lt;P&gt;Thanks, it's perfect, seems so simple...when you master Regex ;-))&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 20:02:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-REGEX-match-ignoring-non-mandatory-string-at-its-end/m-p/550270#M156148</guid>
      <dc:creator>Flo-Paris</dc:creator>
      <dc:date>2021-05-03T20:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help on REGEX match ignoring non-mandatory string at its end</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-on-REGEX-match-ignoring-non-mandatory-string-at-its-end/m-p/550387#M156184</link>
      <description>&lt;P&gt;speaking of which....in case there are some rogues parens in the message, maybe this is even a bit safer - instead of matching everything...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;\((?&amp;lt;rule_name&amp;gt;[^\(]+?)(?:-00)?\)$&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 12:12:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-on-REGEX-match-ignoring-non-mandatory-string-at-its-end/m-p/550387#M156184</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2021-05-04T12:12:23Z</dc:date>
    </item>
  </channel>
</rss>

