<?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 with regex in transforms in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423392#M170720</link>
    <description>&lt;P&gt;Does this do the trick?&lt;/P&gt;

&lt;P&gt;(?[\w\s]+)&amp;lt;\/COMPID&amp;gt;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Jun 2019 16:05:35 GMT</pubDate>
    <dc:creator>kmorris_splunk</dc:creator>
    <dc:date>2019-06-14T16:05:35Z</dc:date>
    <item>
      <title>Help with regex in transforms</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423391#M170719</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm hoping that someone can help me with a regex.  &lt;/P&gt;

&lt;P&gt;Here's the source data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;OTHERFIELD&amp;gt;some values&amp;lt;/OTHERFIELD&amp;gt;&amp;lt;COMPID&amp;gt;string1 node 1&amp;lt;/COMPID&amp;gt;&amp;lt;MOREOTHERFIELDS&amp;gt;more values&amp;lt;/MOREOTHERFIELDS&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to extract everything between  the COMPID brackets.  I have the following, but it's grabbing the extra bracket at the end.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = \&amp;lt;COMPID\&amp;gt;(?&amp;lt;dvcTEST&amp;gt;\w*\s)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've tried regex101 site, but wasn't able to get it right. &lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 15:58:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423391#M170719</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2019-06-14T15:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex in transforms</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423392#M170720</link>
      <description>&lt;P&gt;Does this do the trick?&lt;/P&gt;

&lt;P&gt;(?[\w\s]+)&amp;lt;\/COMPID&amp;gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 16:05:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423392#M170720</guid>
      <dc:creator>kmorris_splunk</dc:creator>
      <dc:date>2019-06-14T16:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex in transforms</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423393#M170721</link>
      <description>&lt;P&gt;This is in transforms.conf, so where would the field get defined?  I tried that, it errors out when restarting the search-head:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;REGEX = \&amp;lt;COMPID\&amp;gt;(?[\w\s]+)&amp;lt;\/COMPID&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Jun 2019 16:37:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423393#M170721</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2019-06-14T16:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex in transforms</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423394#M170722</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15462"&gt;@a212830&lt;/a&gt; , &lt;BR /&gt;
I would do this as a one-liner in props.conf:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE&gt;EXTRACT-compid = \&amp;lt;COMPID\&amp;gt;(?&amp;lt;dvcTEST&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/COMPID\&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;But if you REALLY want to do it in props.conf &amp;amp; transforms.conf:&lt;BR /&gt;
props.conf&lt;BR /&gt;
&lt;PRE&gt;REPORT-extract_compid = extract_compid&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;transforms.conf&lt;BR /&gt;
&lt;PRE&gt;[extract_compid]&lt;BR /&gt;
REGEX = &amp;amp;lt;COMPID&amp;amp;gt;(?&amp;lt;dvcTEST&amp;gt;[^&amp;amp;lt;]+)&amp;amp;lt;\/COMPID&amp;amp;gt;&lt;BR /&gt;
FORMAT = dvcTEST::$1&lt;/PRE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:56:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423394#M170722</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2020-09-30T00:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex in transforms</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423395#M170723</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;P&gt;&amp;lt;\COMPID&amp;gt;(.*?)&amp;lt;&lt;/P&gt;

&lt;P&gt;*take out \ in &amp;lt;\COMPID&amp;gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 17:02:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423395#M170723</guid>
      <dc:creator>wneighbo</dc:creator>
      <dc:date>2019-06-14T17:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex in transforms</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423396#M170724</link>
      <description>&lt;P&gt;Thanks.  I like that better.  What if I just wanted the first word between the brackets?  I have similiar ones where only the first word is needed. &lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 17:06:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423396#M170724</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2019-06-14T17:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex in transforms</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423397#M170725</link>
      <description>&lt;P&gt;Then you would use a regex match for any non-whitespace character.  As an example:&lt;BR /&gt;
Instead of &lt;CODE&gt;[^\&amp;lt;]+&lt;/CODE&gt;&lt;BR /&gt;
Use &lt;CODE&gt;\S+&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 18:38:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423397#M170725</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-14T18:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex in transforms</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423398#M170726</link>
      <description>&lt;P&gt;Tried this, but it didn't work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-testcompid = \&amp;lt;COMPID\&amp;gt;(?&amp;lt;testdvc&amp;gt;\S+)\&amp;lt;\/COMPID\&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm trying to get the first word between the COMPID brackets.  &lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 19:42:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423398#M170726</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2019-06-14T19:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex in transforms</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423399#M170727</link>
      <description>&lt;P&gt;add .*?  after your named group or remove  &amp;lt;\/COMPID&amp;gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 19:56:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423399#M170727</guid>
      <dc:creator>wneighbo</dc:creator>
      <dc:date>2019-06-14T19:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex in transforms</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423400#M170728</link>
      <description>&lt;P&gt;So, this?  &lt;CODE&gt;EXTRACT-testcompid = \&amp;lt;COMPID\&amp;gt;(?&amp;lt;testdvc&amp;gt;.*?)\&amp;lt;\/COMPID\&amp;gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I tried it in regex101, and it didn't get anything.  &lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 20:00:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423400#M170728</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2019-06-14T20:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex in transforms</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423401#M170729</link>
      <description>&lt;P&gt;Elimnated the COMPID, and it worked.  Thanks everyone!  Much appreciated. &lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 20:11:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423401#M170729</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2019-06-14T20:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex in transforms</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423402#M170730</link>
      <description>&lt;P&gt;This would work: &lt;CODE&gt;EXTRACT-testcompid = \&amp;lt;COMPID\&amp;gt;(?&amp;lt;testdvc&amp;gt;\S+).*?\&amp;lt;\/COMPID\&amp;gt;&lt;/CODE&gt;&lt;BR /&gt;
But using: &lt;CODE&gt;EXTRACT-testcompid = \&amp;lt;COMPID\&amp;gt;(?&amp;lt;testdvc&amp;gt;\S+)&lt;/CODE&gt; works as well.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 20:13:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-in-transforms/m-p/423402#M170730</guid>
      <dc:creator>jnudell_2</dc:creator>
      <dc:date>2019-06-14T20:13:44Z</dc:date>
    </item>
  </channel>
</rss>

