<?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: extract field value/variable into regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/extract-field-value-variable-into-regex/m-p/549575#M155949</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/233446"&gt;@yuming1127&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;No, you cannot use field values in the regex. Instead of that, you can extract the product name into a separate field and compare it with the actual one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;my search...... product_name="orange_wallet"
| fields product_name,productID,tag_description
| rex field=tag_description "(?i)(?&amp;lt;product_name_rex&amp;gt;\w+)(?&amp;lt;description&amp;gt;\w+)(?&amp;lt;size&amp;gt;\w+)"
| where lower(product_name)=lower(product_name_rex)
| table product_name,productID,description,size&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this reply helps you, a like would be appreciated.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Apr 2021 09:28:40 GMT</pubDate>
    <dc:creator>manjunathmeti</dc:creator>
    <dc:date>2021-04-28T09:28:40Z</dc:date>
    <item>
      <title>extract field value/variable into regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-field-value-variable-into-regex/m-p/549553#M155941</link>
      <description>&lt;P&gt;my search...... product_name="orange_wallet"&lt;BR /&gt;| fields product_name,productID&lt;BR /&gt;| rex field=tag_description "(?i)orange_wallet(?&amp;lt;description&amp;gt;\w+)(?&amp;lt;size&amp;gt;\w+)"&lt;BR /&gt;| table product_name,productID,description,size&lt;BR /&gt;&lt;BR /&gt;My question is can we include a field values into the regex? Aim is to replace orange_wallet with &amp;lt;product_name&amp;gt; and it need to be case insensitive.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 03:35:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-field-value-variable-into-regex/m-p/549553#M155941</guid>
      <dc:creator>yuming1127</dc:creator>
      <dc:date>2021-04-28T03:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: extract field value/variable into regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-field-value-variable-into-regex/m-p/549575#M155949</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/233446"&gt;@yuming1127&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;No, you cannot use field values in the regex. Instead of that, you can extract the product name into a separate field and compare it with the actual one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;my search...... product_name="orange_wallet"
| fields product_name,productID,tag_description
| rex field=tag_description "(?i)(?&amp;lt;product_name_rex&amp;gt;\w+)(?&amp;lt;description&amp;gt;\w+)(?&amp;lt;size&amp;gt;\w+)"
| where lower(product_name)=lower(product_name_rex)
| table product_name,productID,description,size&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this reply helps you, a like would be appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 09:28:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-field-value-variable-into-regex/m-p/549575#M155949</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2021-04-28T09:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: extract field value/variable into regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-field-value-variable-into-regex/m-p/549577#M155950</link>
      <description>&lt;P&gt;You have reduced your fields to just product_name and productID, so there is not tag_description field for the rex to work on.&lt;/P&gt;&lt;P&gt;Perhaps, if you could share some anonymised events that you want to extract the fields from, we might be able to find a way to get what you want.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 08:45:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-field-value-variable-into-regex/m-p/549577#M155950</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-28T08:45:46Z</dc:date>
    </item>
  </channel>
</rss>

