<?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 help in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144283#M40147</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;.+/(?&amp;lt;hostname&amp;gt;.+?)\_
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 15 Nov 2013 15:06:34 GMT</pubDate>
    <dc:creator>dmaislin_splunk</dc:creator>
    <dc:date>2013-11-15T15:06:34Z</dc:date>
    <item>
      <title>Regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144280#M40144</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I am new to splunk and regex, sorry for poor knowledge.&lt;/P&gt;

&lt;P&gt;I am trying to extract hostname from &lt;BR /&gt;
/var/log/syslog/2013/11/14/hostname_messages.log&lt;BR /&gt;
So far I came up with [a-zA-Z]*&lt;EM&gt;([^&lt;/EM&gt;]+).log$ but this result has _messages.log.&lt;BR /&gt;
How Can I get rid of this part?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:17:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144280#M40144</guid>
      <dc:creator>ytanaka</dc:creator>
      <dc:date>2020-09-28T15:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144281#M40145</link>
      <description>&lt;P&gt;How about:&lt;/P&gt;

&lt;P&gt;/([a-zA-Z0-9]+)_messages\.log&lt;/P&gt;

&lt;P&gt;Assuming that 'hostname' only contains alpha-numeric characters.&lt;/P&gt;

&lt;P&gt;Or, if your 'hostname' doesn't include underscores:&lt;/P&gt;

&lt;P&gt;/([^_/]+)_messages\.log&lt;/P&gt;

&lt;P&gt;You need to 'escape' the period character, as it has a special meaning in regex.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2013 14:37:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144281#M40145</guid>
      <dc:creator>gmor</dc:creator>
      <dc:date>2013-11-15T14:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144282#M40146</link>
      <description>&lt;P&gt;This should work for you. This takes anything between last "/" and "_".&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;".*/(?&amp;lt;host&amp;gt;[^_]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Nov 2013 14:50:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144282#M40146</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-11-15T14:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144283#M40147</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;.+/(?&amp;lt;hostname&amp;gt;.+?)\_
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Nov 2013 15:06:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144283#M40147</guid>
      <dc:creator>dmaislin_splunk</dc:creator>
      <dc:date>2013-11-15T15:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144284#M40148</link>
      <description>&lt;P&gt;Are you trying to extract the hostname as part of an input, in inputs.conf or are you trying the use the 'rex' command in the Search App?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2013 15:10:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144284#M40148</guid>
      <dc:creator>gmor</dc:creator>
      <dc:date>2013-11-15T15:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144285#M40149</link>
      <description>&lt;P&gt;This works like a charm!!&lt;BR /&gt;
So this is using &lt;HOSTNAME&gt; variable.&lt;BR /&gt;
Thanks a lot!&lt;/HOSTNAME&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2013 22:32:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144285#M40149</guid>
      <dc:creator>ytanaka</dc:creator>
      <dc:date>2013-11-15T22:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144286#M40150</link>
      <description>&lt;P&gt;No problem.  Please check the checkmark next to this post to accept the answer.  Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2013 22:38:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/144286#M40150</guid>
      <dc:creator>dmaislin_splunk</dc:creator>
      <dc:date>2013-11-15T22:38:52Z</dc:date>
    </item>
  </channel>
</rss>

