<?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 edit my regular expression to extract a field from my sample log event? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regular-expression-to-extract-a-field-from-my/m-p/274781#M82888</link>
    <description>&lt;P&gt;If you just want to capture everything after &lt;CODE&gt;ms&lt;/CODE&gt; till the end, you can use this regex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\d+\s+ms\.\s+(?&amp;lt;url&amp;gt;.*)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 12 Sep 2016 20:32:47 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-09-12T20:32:47Z</dc:date>
    <item>
      <title>How do I edit my regular expression to extract a field from my sample log event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regular-expression-to-extract-a-field-from-my/m-p/274779#M82886</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I am trying to extract a field from a log event, but need help as my RegEx seems to be wrong.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Input string&lt;/STRONG&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2011-07-11 14:45:59,965 | PERF  | [http-jboss-vm-a1b25.prod.v3-nonpid-brown.cloud.ab.com/12.47.5.87:8223-34] | [com.ab.fap.webser.client.RestServiceClient] | [0b108g34-9529-707c-6e2c-fd510206d1md] | [] | TIME: (0) 2011/07/11 14:45:59:943 to 14:45:59:965 19 ms. &lt;A href="https://abcdefapi.ab.com/v4/sof/bcp/{ssf_nuid}" target="test_blank"&gt;https://abcdefapi.ab.com/v4/sof/bcp/{ssf_nuid}&lt;/A&gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Regular expression used: &lt;CODE&gt;^(?:[^:\n]*:){10}\d+\s+\d+\s+\w+\.\s+&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The regular expression matches the string up to &lt;CODE&gt;ms&lt;/CODE&gt; as given below,&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1827i9040AA123BA4D837/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;I want to extract anything after &lt;CODE&gt;ms&lt;/CODE&gt; i.e. the value "&lt;A href="https://abcdefapi.ab.com/v4/sof/bcp/%7Bssf_nuid%7D"&gt;https://abcdefapi.ab.com/v4/sof/bcp/{ssf_nuid}&lt;/A&gt;" in this case.&lt;BR /&gt;
Please tell me what is incorrect in the below command or what the correct command is.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Command used&lt;/STRONG&gt;: &lt;BR /&gt;
&lt;CODE&gt;source="abc.log"|rex field=_raw "^(?:[^:\n]*:){10}\d+\s+\d+\s+\w+\.\s+(?P)\w+"&lt;/CODE&gt; does not extract&lt;/P&gt;

&lt;P&gt;NOTE: All field values have been changed to dummy values and do not represent the real configurations.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2016 19:09:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regular-expression-to-extract-a-field-from-my/m-p/274779#M82886</guid>
      <dc:creator>namritha</dc:creator>
      <dc:date>2016-09-12T19:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my regular expression to extract a field from my sample log event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regular-expression-to-extract-a-field-from-my/m-p/274780#M82887</link>
      <description>&lt;P&gt;You're falling into the common trap of trying to match more than is necessary.  If you're only interested in the URL, then write a regex for a URL.  This works with your sample.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="abc.log" | rex "(?&amp;lt;url&amp;gt;http[s]:\/\/.*)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Sep 2016 20:31:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regular-expression-to-extract-a-field-from-my/m-p/274780#M82887</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-09-12T20:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my regular expression to extract a field from my sample log event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regular-expression-to-extract-a-field-from-my/m-p/274781#M82888</link>
      <description>&lt;P&gt;If you just want to capture everything after &lt;CODE&gt;ms&lt;/CODE&gt; till the end, you can use this regex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\d+\s+ms\.\s+(?&amp;lt;url&amp;gt;.*)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Sep 2016 20:32:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regular-expression-to-extract-a-field-from-my/m-p/274781#M82888</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-09-12T20:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my regular expression to extract a field from my sample log event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regular-expression-to-extract-a-field-from-my/m-p/274782#M82889</link>
      <description>&lt;P&gt;upvote on this, because it matches in less steps and therefore is much faster &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2016 20:40:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regular-expression-to-extract-a-field-from-my/m-p/274782#M82889</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-09-12T20:40:11Z</dc:date>
    </item>
  </channel>
</rss>

