<?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: Need the correct regular expression for my rex command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436318#M173302</link>
    <description>&lt;P&gt;Perfect! thank you!&lt;/P&gt;</description>
    <pubDate>Tue, 29 Jan 2019 19:40:17 GMT</pubDate>
    <dc:creator>moizmmz</dc:creator>
    <dc:date>2019-01-29T19:40:17Z</dc:date>
    <item>
      <title>Need the correct regular expression for my rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436316#M173300</link>
      <description>&lt;P&gt;Here is my event's raw data: &lt;/P&gt;

&lt;P&gt;{"line":"level=info t=\"2019-01-29T18:19:42.999Z\" rt=2 method=GET path=\"/contentskus/5b7ee52a4f6b9c001b049ac3?dma=999\u0026itemsPerPage=25\u0026page=1\" sc=200 dma=999 apikey=DEFAULT amzn_trace_id=unknown enabledFeatures=recommendations,upcomingSearch,popularityQueriesPlatformSpecific,availabilityTimes,avoidDefaultQuery,useFavoritesExternalSchemaForD2C,useFavoritesV2ForFavoritesFilter,endCardRecommendations,cmsAuthFallback os=2 rid=\"6962240ed296c770\" mode=published","source":"stdout","tag":"ecs-uat_&lt;STRONG&gt;admin_v1sandbox_blue&lt;/STRONG&gt;-35-uat-service-admin-d8d0a7a0c2dfe8ea6c00/503343765eaa","attrs":{"SERVICE_NAME":"admin","SERVICE_TAGS":"contentgroups,contentsettings,contentskus,metatags,settings,userroles,users,s3signurl","SERVICE_VERSION":"v1sandbox","com.amazonaws.ecs.task-arn":"arn:aws:ecs:us-west-2:776609208984:task/305f6e5a-d20d-4aa2-877d-1bba2d442a7b"}}&lt;/P&gt;

&lt;P&gt;I'm trying to create a new field called service_name where I extract the highlighted portion in the above event. The regukar expression that I wrote is: \W\W\W[e][c][s]\S(?\w{1,})&lt;/P&gt;

&lt;P&gt;Achieved result: uat_admin_v1sandbox_blue&lt;BR /&gt;
Expected result: admin_v1sandbox_blue&lt;/P&gt;

&lt;P&gt;Please help!!!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:00:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436316#M173300</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2020-09-29T23:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: Need the correct regular expression for my rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436317#M173301</link>
      <description>&lt;P&gt;Hi @moizmmz &lt;/P&gt;

&lt;P&gt;Does this work for you:  &lt;CODE&gt;\"tag\":\"[^\-]+\-[^\_]+\_([^\-]+)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/XFwLwU/1/"&gt;https://regex101.com/r/XFwLwU/1/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Good luck &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2019 19:21:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436317#M173301</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-01-29T19:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need the correct regular expression for my rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436318#M173302</link>
      <description>&lt;P&gt;Perfect! thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2019 19:40:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436318#M173302</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2019-01-29T19:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need the correct regular expression for my rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436319#M173303</link>
      <description>&lt;P&gt;The easiest way to check for any regular expression is using splunk extract fields. Its quite powerful and gives almost exact extraction.&lt;BR /&gt;
you can see the regular expression used and apply the same in your query using "rex " command.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2019 19:53:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436319#M173303</guid>
      <dc:creator>saurabh009</dc:creator>
      <dc:date>2019-01-29T19:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Need the correct regular expression for my rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436320#M173304</link>
      <description>&lt;P&gt;Can you pls explain this part: [^-]+-[^_]+_([^-]+) ??&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2019 19:59:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436320#M173304</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2019-01-29T19:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: Need the correct regular expression for my rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436321#M173305</link>
      <description>&lt;P&gt;problem is, the events don't load in the sample events slot more than half the time &lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2019 20:06:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436321#M173305</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2019-01-29T20:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: Need the correct regular expression for my rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436322#M173306</link>
      <description>&lt;P&gt;It means any characters except for hypon &lt;BR /&gt;
then a hyphon&lt;BR /&gt;
 then anything except for an underscore &lt;BR /&gt;
Then an underscore&lt;BR /&gt;
Then capture everything until a hyphon&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2019 21:02:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436322#M173306</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-01-29T21:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Need the correct regular expression for my rex command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436323#M173307</link>
      <description>&lt;P&gt;Awesome!!! thanks!!!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2019 21:31:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-the-correct-regular-expression-for-my-rex-command/m-p/436323#M173307</guid>
      <dc:creator>moizmmz</dc:creator>
      <dc:date>2019-01-29T21:31:57Z</dc:date>
    </item>
  </channel>
</rss>

