<?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: Apply Regex to a field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-apply-regex-to-a-field/m-p/644237#M223153</link>
    <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;Hi, use &lt;FONT face="courier new,courier"&gt;search&lt;/FONT&gt; instead of &lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt; and problem solved.&lt;/P&gt;&lt;P&gt;Or you could also do &lt;FONT face="courier new,courier"&gt;| where isNotNull(ppp)&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 23 May 2023 09:59:27 GMT</pubDate>
    <dc:creator>javiergn</dc:creator>
    <dc:date>2023-05-23T09:59:27Z</dc:date>
    <item>
      <title>How to apply regex to a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-apply-regex-to-a-field/m-p/644226#M223147</link>
      <description>&lt;P&gt;Hello Splunkers,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i want to to extract a 10-digit path from a url but unfortunately i always get this error:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;Error in 'rex' command: The regex '.*\/(([0-9a-z]{10}))' does not extract anything. It should specify at least one named group. Format: (?&amp;lt;name&amp;gt;...).&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;how ever, i want to extract the path from this URL &amp;nbsp;&lt;A href="https://example.com/8a2a6063b3" target="_blank" rel="noopener"&gt;https://example.com/&lt;STRONG&gt;8a2a6063b3&lt;/STRONG&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;this is the search i used&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;index=FP_proxy | rex field=url "http[s]?:\/\/[a-zA-Z0-9-]{1,}\..*\/(([0-9a-z]{10})?&amp;lt;url__path&amp;gt;)"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;your help is much needed and appreciated&amp;nbsp;to fix this issue&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 13:34:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-apply-regex-to-a-field/m-p/644226#M223147</guid>
      <dc:creator>msalghamdi</dc:creator>
      <dc:date>2023-05-23T13:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Apply Regex to a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-apply-regex-to-a-field/m-p/644227#M223148</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/256839"&gt;@msalghamdi&lt;/a&gt; , the capturing group in your regex has the wrong format. Try moving the label to the beginning. Like this:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;index=FP_proxy | rex field=url "http[s]?:\/\/[a-zA-Z0-9-]{1,}\..*\/(?&amp;lt;url__path&amp;gt;[0-9a-z]{10})"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Which is going to extract 8a2a6063b3 into the url__path field.&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;J&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 08:52:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-apply-regex-to-a-field/m-p/644227#M223148</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2023-05-23T08:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Apply Regex to a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-apply-regex-to-a-field/m-p/644235#M223151</link>
      <description>&lt;P&gt;thanks&amp;nbsp;&lt;SPAN&gt;javiergn&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;one more question &lt;FONT face="arial,helvetica,sans-serif"&gt;please&lt;/FONT&gt;, i want to apply a condition on the extracted field that is must exist, here's my search:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;index=proxy | rex field=url "http[s]?:\/\/[\w]{1,}\.[\w]{1,}\/(?&amp;lt;ppp&amp;gt;[0-9a-z]{10})$" &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;| where ppp=*&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;| table _time src dest_ip dest user ppp url status&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;but i get this error:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;Error in 'where' command: The expression is malformed. An unexpected character&amp;nbsp; is reached at '* '.&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;what can i do to fix this ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 09:38:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-apply-regex-to-a-field/m-p/644235#M223151</guid>
      <dc:creator>msalghamdi</dc:creator>
      <dc:date>2023-05-23T09:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: Apply Regex to a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-apply-regex-to-a-field/m-p/644237#M223153</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;Hi, use &lt;FONT face="courier new,courier"&gt;search&lt;/FONT&gt; instead of &lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt; and problem solved.&lt;/P&gt;&lt;P&gt;Or you could also do &lt;FONT face="courier new,courier"&gt;| where isNotNull(ppp)&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 23 May 2023 09:59:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-apply-regex-to-a-field/m-p/644237#M223153</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2023-05-23T09:59:27Z</dc:date>
    </item>
  </channel>
</rss>

