<?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 keeps extracting wrong data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-does-regex-keeps-extracting-wrong-data/m-p/619659#M215364</link>
    <description>&lt;P&gt;That just extracts the entire event unfortunately&lt;/P&gt;&lt;P&gt;Thanks anyway though&lt;/P&gt;</description>
    <pubDate>Fri, 04 Nov 2022 14:21:42 GMT</pubDate>
    <dc:creator>jhilton90</dc:creator>
    <dc:date>2022-11-04T14:21:42Z</dc:date>
    <item>
      <title>Why does regex keeps extracting wrong data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-regex-keeps-extracting-wrong-data/m-p/619636#M215356</link>
      <description>&lt;P&gt;I am trying to use the rex command to extract an id number, which is a mixture of letters and numbers separated by a dash. For example, one of the ids looks like this:&lt;/P&gt;
&lt;P&gt;34gv564-3333-5tg4-gt53-4rgt5eg5g35gb&lt;/P&gt;
&lt;P&gt;The field itself is as follows: MFA challenge succeeded for account aaaaaaaaa with email &lt;A href="mailto:example@example.co.uk" target="_blank" rel="noopener"&gt;example@example.co.uk&lt;/A&gt;. Session id is&amp;nbsp;34gv564-3333-5tg4-gt53-4rgt5eg5g35gb&lt;/P&gt;
&lt;P&gt;The rex command I'm using is as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rex "(?i) is (?&amp;lt;id_number&amp;gt;[^\"]+)"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only problem is that sometimes it extracts the email address bit too&lt;/P&gt;
&lt;P&gt;Any help would be greatly appreciated&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 16:34:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-regex-keeps-extracting-wrong-data/m-p/619636#M215356</guid>
      <dc:creator>jhilton90</dc:creator>
      <dc:date>2022-11-04T16:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Regex keeps extracting wrong data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-regex-keeps-extracting-wrong-data/m-p/619643#M215359</link>
      <description>&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;| rex ^(?&amp;lt;id_number&amp;gt;.+)&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 12:55:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-regex-keeps-extracting-wrong-data/m-p/619643#M215359</guid>
      <dc:creator>karu0711</dc:creator>
      <dc:date>2022-11-04T12:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Regex keeps extracting wrong data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-regex-keeps-extracting-wrong-data/m-p/619659#M215364</link>
      <description>&lt;P&gt;That just extracts the entire event unfortunately&lt;/P&gt;&lt;P&gt;Thanks anyway though&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 14:21:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-regex-keeps-extracting-wrong-data/m-p/619659#M215364</guid>
      <dc:creator>jhilton90</dc:creator>
      <dc:date>2022-11-04T14:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Regex keeps extracting wrong data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-regex-keeps-extracting-wrong-data/m-p/619676#M215370</link>
      <description>&lt;P&gt;To avoid extracting data from the wrong place, the regex should be more specific.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "Session id is (?&amp;lt;id_number&amp;gt;[^\"]+)"&lt;/LI-CODE&gt;&lt;P&gt;Since we only have a partial event to work with (the regex implies something in quotes follows, but it's not in the example event), it's impossible to know if there is a better way to extract the field.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 15:36:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-regex-keeps-extracting-wrong-data/m-p/619676#M215370</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-11-04T15:36:51Z</dc:date>
    </item>
  </channel>
</rss>

