<?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: How do I write the regex to capture the database name and major version from my sample data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244354#M72772</link>
    <description>&lt;P&gt;Just change &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"DB2(?&amp;lt;version&amp;gt;\s\d+\.\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"(?&amp;lt;version&amp;gt;DB2\s\d+\.\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Everything inside of the parenthesis is going to be "captured". Everything outside of the parenthesis is going to be "matched".&lt;/P&gt;</description>
    <pubDate>Tue, 24 Nov 2015 16:06:29 GMT</pubDate>
    <dc:creator>aljohnson_splun</dc:creator>
    <dc:date>2015-11-24T16:06:29Z</dc:date>
    <item>
      <title>How do I write the regex to capture the database name and major version from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244348#M72766</link>
      <description>&lt;P&gt;I am struggling with the regex match on the below pattern. I need to capture major version name from below ( DB2 9.7,DB2 10.1 ) . Pretty much first letter till second "." . Any help?&lt;/P&gt;

&lt;P&gt;DB2 9.7.10.1 &lt;BR /&gt;
DB2 10.1.4.4 &lt;BR /&gt;
DB2 9.7.600.413 &lt;BR /&gt;
DB2 9.7.9.8 &lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 14:10:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244348#M72766</guid>
      <dc:creator>vinay4444</dc:creator>
      <dc:date>2015-11-24T14:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to capture the database name and major version from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244349#M72767</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(\w+\s\d+\.\d+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Nov 2015 15:35:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244349#M72767</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-11-24T15:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to capture the database name and major version from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244350#M72768</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "DB2(?&amp;lt;version&amp;gt;\s\d+\.\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;it will be non permanent. and only exist for the single search.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Based on the fact that this is relatively simple regular expression, I will leave some links here to help you learn.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;A href="http://regexone.com/"&gt;http://regexone.com/&lt;/A&gt; - this is a great interactive tutorial&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt; - test out your regex ! example: &lt;A href="https://regex101.com/r/eF7oF2/1"&gt;https://regex101.com/r/eF7oF2/1&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/AboutSplunkregularexpressions"&gt;Splunk Regular Expressions&lt;/A&gt; - docs are great&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://www.regular-expressions.info/tutorial.html"&gt;Regular Expression Tutorial&lt;/A&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Tue, 24 Nov 2015 15:41:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244350#M72768</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-11-24T15:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to capture the database name and major version from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244351#M72769</link>
      <description>&lt;P&gt;No look all in:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# To extract the Version like "x.y" only:
/DB2\s(\d+\.\d+).*/i
# To extract the whole thing like "DB2 x.y"
/(DB2\s\d+\.\d+).*/i
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have to add, that I'm not sure if this actually fits 100% into Splunk. If you want to extract a field via &lt;CODE&gt;props.conf&lt;/CODE&gt; it would be something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-major_version = DB2\s(?P&amp;lt;major_version&amp;gt;\d+\.\d+).*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To use a regex inline in a search it would be&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... |rex "DB2\s(?&amp;lt;major_version&amp;gt;\d+\.\d+).*"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Nov 2015 15:44:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244351#M72769</guid>
      <dc:creator>Sebastian2</dc:creator>
      <dc:date>2015-11-24T15:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to capture the database name and major version from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244352#M72770</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=XXXX  | rex field=databaseDbServerVersion "DB2(?\s\d+\.\d+)" | table version
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks version now has correct result 10.1,10.5 etc but is there a way to get DB2 10.1 , DB2 9.7 in version &lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 15:51:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244352#M72770</guid>
      <dc:creator>vinay4444</dc:creator>
      <dc:date>2015-11-24T15:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to capture the database name and major version from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244353#M72771</link>
      <description>&lt;P&gt;index=XXXX  | rex field=databaseDbServerVersion "DB2(?\s\d+.\d+)" | table version&lt;/P&gt;

&lt;P&gt;Thanks version now has correct result 10.1,10.5 etc but is there a way to get DB2 10.1 , DB2 9.7 in version &lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 15:51:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244353#M72771</guid>
      <dc:creator>vinay4444</dc:creator>
      <dc:date>2015-11-24T15:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to capture the database name and major version from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244354#M72772</link>
      <description>&lt;P&gt;Just change &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"DB2(?&amp;lt;version&amp;gt;\s\d+\.\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"(?&amp;lt;version&amp;gt;DB2\s\d+\.\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Everything inside of the parenthesis is going to be "captured". Everything outside of the parenthesis is going to be "matched".&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 16:06:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244354#M72772</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-11-24T16:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write the regex to capture the database name and major version from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244355#M72773</link>
      <description>&lt;P&gt;&lt;CODE&gt;(\w+\s\d+\.\d+)&lt;/CODE&gt; will give you exactly what you asked for.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 16:20:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-the-regex-to-capture-the-database-name-and-major/m-p/244355#M72773</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-11-24T16:20:02Z</dc:date>
    </item>
  </channel>
</rss>

