<?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: Trouble with regex in transforms.conf in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Trouble-with-regex-in-transforms-conf/m-p/124055#M33509</link>
    <description>&lt;P&gt;First of all there's no need for anchor your matches with &lt;CODE&gt;^.*&lt;/CODE&gt; and &lt;CODE&gt;.*$&lt;/CODE&gt;. The regex engine will automatically find what you're after anyway. You don't need to escape either of the characters you're escaping.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;MsgType&amp;gt;(SendMessage|ReplyMessage)&amp;lt;/MsgType&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;should work just fine.&lt;/P&gt;</description>
    <pubDate>Thu, 31 Oct 2013 14:52:27 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2013-10-31T14:52:27Z</dc:date>
    <item>
      <title>Trouble with regex in transforms.conf</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trouble-with-regex-in-transforms-conf/m-p/124054#M33508</link>
      <description>&lt;P&gt;I am filtering events in &lt;CODE&gt;transforms.conf&lt;/CODE&gt; but I cannot seem to get the regex to match. When I test the regex in Search it works as expected and even when tested at &lt;A href="http://gskinner.com/RegExr//" title="http://gskinner.com/RegExr/"&gt;http://gskinner.com/RegExr/&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;I'm trying to match on the MsgType tag.&lt;/P&gt;

&lt;P&gt;Sample event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2013-10-28 4:36:38,322  &amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&amp;lt;INTERFACE&amp;gt;&amp;lt;MsgType&amp;gt;SendMessage&amp;lt;/MsgType&amp;gt;&amp;lt;Emailaddress&amp;gt;user@example.com&amp;lt;/Emailaddress&amp;gt;&amp;lt;Userid&amp;gt;9999999999999&amp;lt;/Userid&amp;gt;&amp;lt;FolderName&amp;gt;inbox&amp;lt;/FolderName&amp;gt;&amp;lt;Alerts&amp;gt;false&amp;lt;/Alerts&amp;gt;&amp;lt;Ack&amp;gt;true&amp;lt;/Ack&amp;gt;&amp;lt;To&amp;gt;user@example.com&amp;lt;/To&amp;gt;&amp;lt;/INTERFACE&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Below are variations that I tried that all seem to work but not when used in &lt;CODE&gt;transforms.conf&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;^(.*&amp;lt;MsgType&amp;gt;(SendMessage|ReplyMessage)\b&amp;lt;\/MsgType&amp;gt;).*$&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;^(.*&amp;lt;MsgType.(SendMessage|ReplyMessage)\b&amp;lt;\/).*$&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;^(.*&amp;lt;MsgType.(SendMessage|ReplyMessage)\b&amp;lt;.MsgType.).*$&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;^(.*MsgType.(SendMessage|ReplyMessage)\b..MsgType).*$&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;^(.*&amp;lt;[^&amp;lt;]*MsgType[^&amp;gt;]*&amp;gt;(SendMessage|ReplyMessage)\b&amp;lt;\/[^&amp;lt;\/]*MsgType[^&amp;gt;]*&amp;gt;).*$&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This works but isn't ideal &lt;CODE&gt;^(.*MsgType.(SendMessage|ReplyMessage)\b).*$&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;What's the proper way to escape the opening/closing tags?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2013 14:44:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trouble-with-regex-in-transforms-conf/m-p/124054#M33508</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2013-10-31T14:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with regex in transforms.conf</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trouble-with-regex-in-transforms-conf/m-p/124055#M33509</link>
      <description>&lt;P&gt;First of all there's no need for anchor your matches with &lt;CODE&gt;^.*&lt;/CODE&gt; and &lt;CODE&gt;.*$&lt;/CODE&gt;. The regex engine will automatically find what you're after anyway. You don't need to escape either of the characters you're escaping.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;MsgType&amp;gt;(SendMessage|ReplyMessage)&amp;lt;/MsgType&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;should work just fine.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2013 14:52:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trouble-with-regex-in-transforms-conf/m-p/124055#M33509</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-10-31T14:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with regex in transforms.conf</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trouble-with-regex-in-transforms-conf/m-p/124056#M33510</link>
      <description>&lt;P&gt;Thank you. You are correct and this does work just fine. It seems that a sed script running after the transforms was the issue. I thought it was the regex that was the problem.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2013 19:38:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trouble-with-regex-in-transforms-conf/m-p/124056#M33510</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2013-10-31T19:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with regex in transforms.conf</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trouble-with-regex-in-transforms-conf/m-p/124057#M33511</link>
      <description>&lt;P&gt;As a follow up, running certain sed scripts seem to work without issue while others cause the event to never get indexed. For example, running &lt;CODE&gt;SEDCMD-format= s/Emailaddress/Email/g&lt;/CODE&gt; after &lt;CODE&gt;TRANSFORMS-set= setnull,keep&lt;/CODE&gt; in &lt;CODE&gt;props.conf&lt;/CODE&gt; works but &lt;CODE&gt;SEDCMD-format= s/(.*)&amp;lt;MsgType&amp;gt;(.*)&amp;lt;\/MsgType&amp;gt;.*/\1 MsgType=\2/&lt;/CODE&gt; does not and the event is never indexed. Any ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2013 20:45:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trouble-with-regex-in-transforms-conf/m-p/124057#M33511</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2013-10-31T20:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble with regex in transforms.conf</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trouble-with-regex-in-transforms-conf/m-p/124058#M33512</link>
      <description>&lt;P&gt;It looks like my issue was due to the fact that &lt;CODE&gt;SED-*&lt;/CODE&gt; entries are executed prior to &lt;CODE&gt;TRANSFORMS-*&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2013 11:25:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trouble-with-regex-in-transforms-conf/m-p/124058#M33512</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2013-11-05T11:25:04Z</dc:date>
    </item>
  </channel>
</rss>

