<?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: What is the regex syntax to add the name of the field extraction to the full regex command? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-regex-syntax-to-add-the-name-of-the-field-extraction/m-p/292450#M88306</link>
    <description>&lt;P&gt;Any chance you could post some sample source data and the exact value you'd like to extract from it? Or, even better, a link to a regex101 page where you've successfully extracted what you want? Translating that into SPL will be a cinch!&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2018 17:43:49 GMT</pubDate>
    <dc:creator>elliotproebstel</dc:creator>
    <dc:date>2018-02-13T17:43:49Z</dc:date>
    <item>
      <title>What is the regex syntax to add the name of the field extraction to the full regex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-regex-syntax-to-add-the-name-of-the-field-extraction/m-p/292449#M88305</link>
      <description>&lt;P&gt;We are trying to carry out a field extraction in a log that contains xml output.&lt;/P&gt;

&lt;P&gt;We have worked out the regex to get the data we need:- &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;id[^&amp;gt;]*&amp;gt;([LAR]+)(.*?)&amp;lt;\/id&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But splunk will not let us complete the extraction by adding the naming section.&lt;/P&gt;

&lt;P&gt;We tried the below but the then extraction stops working. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;id[^&amp;gt;]*&amp;gt;([LAR]+)(.*?)&amp;lt;\/id&amp;gt;(?P&amp;lt;tradeId&amp;gt;)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Question is what is the regex syntax to add the name of the field extraction to the full regex command.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 17:20:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-regex-syntax-to-add-the-name-of-the-field-extraction/m-p/292449#M88305</guid>
      <dc:creator>alanhowlett</dc:creator>
      <dc:date>2018-02-13T17:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: What is the regex syntax to add the name of the field extraction to the full regex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-regex-syntax-to-add-the-name-of-the-field-extraction/m-p/292450#M88306</link>
      <description>&lt;P&gt;Any chance you could post some sample source data and the exact value you'd like to extract from it? Or, even better, a link to a regex101 page where you've successfully extracted what you want? Translating that into SPL will be a cinch!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 17:43:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-regex-syntax-to-add-the-name-of-the-field-extraction/m-p/292450#M88306</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-02-13T17:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: What is the regex syntax to add the name of the field extraction to the full regex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-is-the-regex-syntax-to-add-the-name-of-the-field-extraction/m-p/292451#M88307</link>
      <description>&lt;P&gt;Is this for extracting fields during a search or before the search via props/transforms? If doing in search what you will want is the "rex" command. The rex command is used for extractions, whereas the regex command is used for filtering. To extract using rex you can try:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| rex field=_raw "&amp;lt;id[^&amp;gt;]*&amp;gt;(?&amp;lt;tradeId&amp;gt;([LAR]+)(.*?))&amp;lt;\/id&amp;gt;"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Here is the reference with examples: &lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.2/SearchReference/Rex"&gt;http://docs.splunk.com/Documentation/Splunk/7.0.2/SearchReference/Rex&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If using props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source/sourcetype/etc]
EXTRACT-tradeId = &amp;lt;id[^&amp;gt;]*&amp;gt;(?&amp;lt;tradeId&amp;gt;([LAR]+)(.*?))&amp;lt;\/id&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm assuming here you want what is between &lt;CODE&gt;&amp;lt;id ...&amp;gt;&amp;lt;/id&amp;gt;&lt;/CODE&gt; captured. It also looks like this requires the field to begin with "L", "A", or "R". Please let me know if this helps. If not, could you post an example event and how you would like it extracted? Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 17:50:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-is-the-regex-syntax-to-add-the-name-of-the-field-extraction/m-p/292451#M88307</guid>
      <dc:creator>mdsnmss</dc:creator>
      <dc:date>2018-02-13T17:50:51Z</dc:date>
    </item>
  </channel>
</rss>

