<?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 to get certain field from data using rex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-certain-field-from-data-using-rex/m-p/551517#M156509</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/233122"&gt;@MeMilo09&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"for " forces a match against that exact text. Without it, your match should have included both the text before the base file name and the base file name itself. The source text doesn't need to begin with "for;" that would require additional logic in the regex.&lt;/P&gt;&lt;P&gt;The (?&amp;lt;xxx&amp;gt;...) sequence defines a capture group with name xxx. In Splunk, xxx becomes the extracted field name.&lt;/P&gt;&lt;P&gt;[^.]+ means "match one or more characters that are not a period." The match will stop when it encounters the dot in the file name.&lt;/P&gt;</description>
    <pubDate>Fri, 14 May 2021 01:11:06 GMT</pubDate>
    <dc:creator>tscroggins</dc:creator>
    <dc:date>2021-05-14T01:11:06Z</dc:date>
    <item>
      <title>How to get certain field from data using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-certain-field-from-data-using-rex/m-p/551410#M156485</link>
      <description>&lt;P&gt;Hey There,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have seen the Splunk. com answers and the rex cheat sheets online. However, I cant seem to get rex command to work to extract what I need from the data. I only need the&amp;nbsp;XX_LMP_123456789_123 without the .pdf.&amp;nbsp; Can someone guide me on how to achieve this?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;just need&amp;nbsp;XX_LMP_123456789_123&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;failureMsg="Failure to populate pdf file for XX_LMP_123456789_123.pdf in LOB_1234567_9_4567890_delivery_.pdf"

 &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 00:28:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-certain-field-from-data-using-rex/m-p/551410#M156485</guid>
      <dc:creator>MeMilo09</dc:creator>
      <dc:date>2021-05-13T00:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to get certain field from data using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-certain-field-from-data-using-rex/m-p/551411#M156486</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/233122"&gt;@MeMilo09&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This should work:&lt;/P&gt;&lt;P&gt;| rex field=failureMsg "for (?&amp;lt;basename&amp;gt;.*?)\\.pdf"&lt;/P&gt;&lt;P&gt;or this:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| rex field=failureMsg "for (?&amp;lt;basename&amp;gt;[^.]+)"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and others, depending on how much variation exists in your source text.&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 00:51:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-certain-field-from-data-using-rex/m-p/551411#M156486</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2021-05-13T00:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to get certain field from data using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-certain-field-from-data-using-rex/m-p/551514#M156508</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/49493"&gt;@tscroggins&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks for your help this works perfectly.&amp;nbsp; would you mind explaining the rex characters&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;| rex field=failureMsg "for (?&amp;lt;basename&amp;gt;[^.]+)"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;"for&lt;/STRONG&gt;" why use for here ?- this actually works even if the failureMsg does not begin with for, but not sure why.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;?&lt;/STRONG&gt;&amp;nbsp; stands for 0 or 1, but my failureMsg could have letters too and it works fine. Can you explain why it works?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;STRONG&gt;[^.]+&amp;nbsp;&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;What is the rest doing - I am having a hard time understanding it&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Your explanation would be very helpful for me. Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 May 2021 23:45:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-certain-field-from-data-using-rex/m-p/551514#M156508</guid>
      <dc:creator>MeMilo09</dc:creator>
      <dc:date>2021-05-13T23:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get certain field from data using rex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-certain-field-from-data-using-rex/m-p/551517#M156509</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/233122"&gt;@MeMilo09&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"for " forces a match against that exact text. Without it, your match should have included both the text before the base file name and the base file name itself. The source text doesn't need to begin with "for;" that would require additional logic in the regex.&lt;/P&gt;&lt;P&gt;The (?&amp;lt;xxx&amp;gt;...) sequence defines a capture group with name xxx. In Splunk, xxx becomes the extracted field name.&lt;/P&gt;&lt;P&gt;[^.]+ means "match one or more characters that are not a period." The match will stop when it encounters the dot in the file name.&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 01:11:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-certain-field-from-data-using-rex/m-p/551517#M156509</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2021-05-14T01:11:06Z</dc:date>
    </item>
  </channel>
</rss>

