<?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: Extracting words in a string with regular expressions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435549#M124195</link>
    <description>&lt;P&gt;This will get the string immediately after the # and before the next minus sign:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "#(?&amp;lt;something&amp;gt;[^\-]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you need everything up to the .rss, then:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "#(?&amp;lt;something&amp;gt;[^\.]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If this doesn't work, then please post more event samples.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Aug 2019 12:12:05 GMT</pubDate>
    <dc:creator>jpolvino</dc:creator>
    <dc:date>2019-08-08T12:12:05Z</dc:date>
    <item>
      <title>Extracting words in a string with regular expressions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435542#M124188</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm struggling to get a regular expression for characters in a string.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://status.aws.amazon.com/rss/#elb-us-west-1.rss"&gt;https://status.aws.amazon.com/rss/#elb-us-west-1.rss&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I need "#elb" , but this string is changed each event.&lt;BR /&gt;
(for example, #ec2, #s3,#cloudwatch etc...)&lt;/P&gt;

&lt;P&gt;so,I want to extract all name, but I can not extract this string.&lt;BR /&gt;
(I made     [#]\w*     but it does not work.)&lt;/P&gt;

&lt;P&gt;How can I write a regular expression that gets a string starting with #?&lt;/P&gt;

&lt;P&gt;Thank you for helping.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 08:08:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435542#M124188</guid>
      <dc:creator>pipipipi</dc:creator>
      <dc:date>2019-08-08T08:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting words in a string with regular expressions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435543#M124189</link>
      <description>&lt;P&gt;Hello @pipipipi,&lt;/P&gt;

&lt;P&gt;You can use an eval also, like this: &lt;/P&gt;

&lt;P&gt;index=**** | eval str="&lt;A href="https://status.aws.amazon.com/rss/#elb-us-west-1.rss"&gt;https://status.aws.amazon.com/rss/#elb-us-west-1.rss&lt;/A&gt;" , name=mvindex(split(mvindex(split(str,"#"),1),"-"),0) &lt;BR /&gt;
| dedup str, name | table str, name.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 08:19:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435543#M124189</guid>
      <dc:creator>Kawtar</dc:creator>
      <dc:date>2019-08-08T08:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting words in a string with regular expressions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435544#M124190</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval temp="https://status.aws.amazon.com/rss/#elb-us-west-1.rss" 
| rex field=temp "(?P&amp;lt;result&amp;gt;#[^\/]+$)" 
| eval result =mvindex(split(result,"-"),0)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Aug 2019 08:19:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435544#M124190</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-08-08T08:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting words in a string with regular expressions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435545#M124191</link>
      <description>&lt;P&gt;Thank you for helping me.&lt;/P&gt;

&lt;P&gt;I never thought of it!!&lt;/P&gt;

&lt;H1&gt;elb was extracted.&lt;/H1&gt;

&lt;P&gt;Thank you.&lt;/P&gt;

&lt;P&gt;However, in addition to #elb, I want the names of other  names  such as # ec2 and # s3.&lt;BR /&gt;
I want all the #service names for the data I got.&lt;BR /&gt;
(This http: // ******* will change depending on the service, and there is already a field called id)&lt;BR /&gt;
so, I changed&lt;/P&gt;

&lt;P&gt;| makeresults&lt;BR /&gt;&lt;BR /&gt;
 | rex field=id "(?P#[^\/]+$)" &lt;BR /&gt;
 | eval result =mvindex(split(result,"-"),0)&lt;/P&gt;

&lt;P&gt;But, it does not work.&lt;BR /&gt;
I'm sorry for my English is bad.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 08:47:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435545#M124191</guid>
      <dc:creator>pipipipi</dc:creator>
      <dc:date>2019-08-08T08:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting words in a string with regular expressions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435546#M124192</link>
      <description>&lt;P&gt;Please post some more sample data.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 08:51:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435546#M124192</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-08-08T08:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting words in a string with regular expressions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435547#M124193</link>
      <description>&lt;P&gt;Thank you for helping.&lt;BR /&gt;
There are a lot of different URL in the field called id.&lt;/P&gt;

&lt;P&gt;id field has many URL.&lt;BR /&gt;
For example, &lt;BR /&gt;
&lt;A href="https://status.aws.amazon.com/rss/#elb-us-west-1.rss"&gt;https://status.aws.amazon.com/rss/#elb-us-west-1.rss&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://status.aws.amazon.com/rss/#ec2-us-west-1.rss"&gt;https://status.aws.amazon.com/rss/#ec2-us-west-1.rss&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://status.aws.amazon.com/rss/#apigateway-ap-northeast-2.rss"&gt;https://status.aws.amazon.com/rss/#apigateway-ap-northeast-2.rss&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://status.aws.amazon.com/rss/#apigateway-eu-central-1"&gt;https://status.aws.amazon.com/rss/#apigateway-eu-central-1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I want to extract olny #names.&lt;BR /&gt;
such as&lt;/P&gt;

&lt;H1&gt;ec2&lt;/H1&gt;

&lt;H1&gt;s3&lt;/H1&gt;

&lt;H1&gt;apigateway&lt;/H1&gt;

&lt;H1&gt;elb&lt;/H1&gt;

&lt;P&gt;I'm sorry for I can not attach pictures.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 09:15:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435547#M124193</guid>
      <dc:creator>pipipipi</dc:creator>
      <dc:date>2019-08-08T09:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting words in a string with regular expressions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435548#M124194</link>
      <description>&lt;P&gt;Thank you for your help.&lt;/P&gt;

&lt;P&gt;There are a lot of different URL in the field called id.&lt;/P&gt;

&lt;P&gt;For example,&lt;BR /&gt;
&lt;A href="https://status.aws.amazon.com/rss/#elb-us-west-1.rss"&gt;https://status.aws.amazon.com/rss/#elb-us-west-1.rss&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://status.aws.amazon.com/rss/#ec2-us-west-1.rss"&gt;https://status.aws.amazon.com/rss/#ec2-us-west-1.rss&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://status.aws.amazon.com/rss/#apigateway-ap-northeast-2.rss"&gt;https://status.aws.amazon.com/rss/#apigateway-ap-northeast-2.rss&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://status.aws.amazon.com/rss/#apigateway-eu-central-1"&gt;https://status.aws.amazon.com/rss/#apigateway-eu-central-1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I want to extract  only #name.&lt;/P&gt;

&lt;H1&gt;ec2&lt;/H1&gt;

&lt;H1&gt;s3&lt;/H1&gt;

&lt;H1&gt;apigateway&lt;/H1&gt;

&lt;H1&gt;elb&lt;/H1&gt;

&lt;P&gt;I'm sorry for I can not attach pictures.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 09:18:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435548#M124194</guid>
      <dc:creator>pipipipi</dc:creator>
      <dc:date>2019-08-08T09:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting words in a string with regular expressions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435549#M124195</link>
      <description>&lt;P&gt;This will get the string immediately after the # and before the next minus sign:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "#(?&amp;lt;something&amp;gt;[^\-]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you need everything up to the .rss, then:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "#(?&amp;lt;something&amp;gt;[^\.]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If this doesn't work, then please post more event samples.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 12:12:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435549#M124195</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2019-08-08T12:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting words in a string with regular expressions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435550#M124196</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval id="https://status.aws.amazon.com/rss/#elb-us-west-1.rss,https://status.aws.amazon.com/rss/#ec2-us-west-1.rss,https://status.aws.amazon.com/rss/#apigateway-ap-northeast-2.rss,https://status.aws.amazon.com/rss/#apigateway-eu-central-1" 
| makemv delim="," id 
| mvexpand id 
| rex field=id "(?P&amp;lt;result&amp;gt;#[^\/]+$)" 
| eval result =mvindex(split(result,"-"),0)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Aug 2019 14:02:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-words-in-a-string-with-regular-expressions/m-p/435550#M124196</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-08-08T14:02:58Z</dc:date>
    </item>
  </channel>
</rss>

