<?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 Regex working on regex101 but not in Splunk in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-working-on-regex101-but-not-in-Splunk/m-p/442076#M125546</link>
    <description>&lt;P&gt;I have some ADFS logs that I'm trying to pull the IPs from. My regex is as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?:(^Token\sType):\s*(?:\n(?!Client IP:).*)+\nClient IP:\s*\n|\G)(?&amp;lt;adfs_src&amp;gt;(?:\d{1,3}\.){3}\d{1,3})(?:[,\s]|$)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tested the regex against an ADFS event on regex101 - &lt;A href="https://regex101.com/r/tmKHt0/2"&gt;link text&lt;/A&gt; successfully.&lt;/P&gt;

&lt;P&gt;However, pasting into Splunk, the IPs aren't being pulled out as the adfs_src field&lt;/P&gt;

&lt;P&gt;Any help would be greatly appreciated&lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
    <pubDate>Tue, 07 May 2019 20:21:53 GMT</pubDate>
    <dc:creator>jwalzerpitt</dc:creator>
    <dc:date>2019-05-07T20:21:53Z</dc:date>
    <item>
      <title>Regex working on regex101 but not in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-working-on-regex101-but-not-in-Splunk/m-p/442076#M125546</link>
      <description>&lt;P&gt;I have some ADFS logs that I'm trying to pull the IPs from. My regex is as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?:(^Token\sType):\s*(?:\n(?!Client IP:).*)+\nClient IP:\s*\n|\G)(?&amp;lt;adfs_src&amp;gt;(?:\d{1,3}\.){3}\d{1,3})(?:[,\s]|$)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tested the regex against an ADFS event on regex101 - &lt;A href="https://regex101.com/r/tmKHt0/2"&gt;link text&lt;/A&gt; successfully.&lt;/P&gt;

&lt;P&gt;However, pasting into Splunk, the IPs aren't being pulled out as the adfs_src field&lt;/P&gt;

&lt;P&gt;Any help would be greatly appreciated&lt;/P&gt;

&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 20:21:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-working-on-regex101-but-not-in-Splunk/m-p/442076#M125546</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2019-05-07T20:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Regex working on regex101 but not in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-working-on-regex101-but-not-in-Splunk/m-p/442077#M125547</link>
      <description>&lt;P&gt;Hi jwalzerpitt,&lt;/P&gt;

&lt;P&gt;Try to make it work using the &lt;CODE&gt;rex&lt;/CODE&gt; command in Splunk, and start with a simplified regex like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | rex "Client IP:\s+\n|\G(?&amp;lt;adfs_src&amp;gt;(?:\d{1,3}\.){3}\d{1,3})(?:[,\s]|$)" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Once this works, work your way back to add more criteria to the regex.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 20:28:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-working-on-regex101-but-not-in-Splunk/m-p/442077#M125547</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-05-07T20:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: Regex working on regex101 but not in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-working-on-regex101-but-not-in-Splunk/m-p/442078#M125548</link>
      <description>&lt;P&gt;I simplified as follows and it worked like a charm - thx MuS!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(Client IP:\s*\n|\G)(?&amp;lt;adfs_src&amp;gt;(?:\d{1,3}\.){3}\d{1,3})(?:[,\s]|$)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 May 2019 20:40:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-working-on-regex101-but-not-in-Splunk/m-p/442078#M125548</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2019-05-07T20:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: Regex working on regex101 but not in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-working-on-regex101-but-not-in-Splunk/m-p/442079#M125549</link>
      <description>&lt;P&gt;Nice, converted to answer. Please accept &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 20:50:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-working-on-regex101-but-not-in-Splunk/m-p/442079#M125549</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-05-07T20:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Regex working on regex101 but not in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-working-on-regex101-but-not-in-Splunk/m-p/442080#M125550</link>
      <description>&lt;P&gt;You have both the &lt;CODE&gt;global&lt;/CODE&gt; and &lt;CODE&gt;multiline&lt;/CODE&gt; flags set so you need to ensure that these are set in Splunk, too.  Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; .... | rex max_match=0 "(?ms)Client IP:\s+\n|\G(?&amp;lt;adfs_src&amp;gt;(?:\d{1,3}\.){3}\d{1,3})(?:[,\s]|$)" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 May 2019 01:38:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-working-on-regex101-but-not-in-Splunk/m-p/442080#M125550</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-05-08T01:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Regex working on regex101 but not in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-working-on-regex101-but-not-in-Splunk/m-p/442081#M125551</link>
      <description>&lt;P&gt;That worked as well - thx&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 12:28:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-working-on-regex101-but-not-in-Splunk/m-p/442081#M125551</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2019-05-08T12:28:31Z</dc:date>
    </item>
  </channel>
</rss>

