<?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 to extract the end of a string (from a field) before a  specific character (starting form the right) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-the-end-of-a-string-from-a-field-before-a/m-p/488849#M136536</link>
    <description>&lt;P&gt;Regular expressions work left-to-right so what you want is everything after the last "=".  Or is it more precise to say you want the UID string?  If the latter, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "&amp;amp;uid=(?&amp;lt;uid&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 18 Jan 2020 18:22:23 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-01-18T18:22:23Z</dc:date>
    <item>
      <title>Regex to extract the end of a string (from a field) before a  specific character (starting form the right)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-the-end-of-a-string-from-a-field-before-a/m-p/488848#M136535</link>
      <description>&lt;P&gt;Hi Everyone:&lt;/P&gt;

&lt;P&gt;I'd like to extract everything before the first "=" below (starting from the right):&lt;/P&gt;

&lt;P&gt;sender=john&amp;amp;uid=&lt;STRONG&gt;johndoe&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Note: I will be dealing with varying uid's and string lengths. &lt;/P&gt;

&lt;P&gt;Any assistance would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2020 04:21:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-the-end-of-a-string-from-a-field-before-a/m-p/488848#M136535</guid>
      <dc:creator>mdeterville</dc:creator>
      <dc:date>2020-01-18T04:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to extract the end of a string (from a field) before a  specific character (starting form the right)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-the-end-of-a-string-from-a-field-before-a/m-p/488849#M136536</link>
      <description>&lt;P&gt;Regular expressions work left-to-right so what you want is everything after the last "=".  Or is it more precise to say you want the UID string?  If the latter, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "&amp;amp;uid=(?&amp;lt;uid&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Jan 2020 18:22:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-the-end-of-a-string-from-a-field-before-a/m-p/488849#M136536</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-01-18T18:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to extract the end of a string (from a field) before a  specific character (starting form the right)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-the-end-of-a-string-from-a-field-before-a/m-p/488850#M136537</link>
      <description>&lt;P&gt;Even more generic, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "(?&amp;lt;last_word&amp;gt;[^=]+$)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Jan 2020 18:47:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-the-end-of-a-string-from-a-field-before-a/m-p/488850#M136537</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-01-18T18:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to extract the end of a string (from a field) before a  specific character (starting form the right)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-the-end-of-a-string-from-a-field-before-a/m-p/488851#M136538</link>
      <description>&lt;P&gt;Plan A:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="something_time something  test=foobaa&amp;amp;sender=john&amp;amp;uid=johndoe"
| extract pairdelim="&amp;amp;" kvdelim="="
| eval uid_length=len(uid)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It may not be so easy, I tried to extract from  &lt;CODE&gt;_raw&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Plan B:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval your_field="foobaa&amp;amp;sender=john&amp;amp;uid=johndoe"
| eval tmp=mvindex(split(your_field,"&amp;amp;"),mvfind(split(your_field,"&amp;amp;"),"uid"))
| eval uid=mvindex(split(tmp,"="),1)
| eval uid_length=len(uid)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;All plans are REGEX-free&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2020 23:52:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-the-end-of-a-string-from-a-field-before-a/m-p/488851#M136538</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-18T23:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Regex to extract the end of a string (from a field) before a  specific character (starting form the right)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-the-end-of-a-string-from-a-field-before-a/m-p/488852#M136539</link>
      <description>&lt;P&gt;This worked, thank you so much!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 14:54:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-to-extract-the-end-of-a-string-from-a-field-before-a/m-p/488852#M136539</guid>
      <dc:creator>mdeterville</dc:creator>
      <dc:date>2020-01-20T14:54:56Z</dc:date>
    </item>
  </channel>
</rss>

