<?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: Wildcard in middle of search string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291133#M87951</link>
    <description>&lt;P&gt;@shabdadev, you might have to read about &lt;STRONG&gt;match()&lt;/STRONG&gt; function again(&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/ConditionalFunctions#match.28SUBJECT.2C_.22REGEX.22.29"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/ConditionalFunctions#match.28SUBJECT.2C_.22REGEX.22.29&lt;/A&gt;). Match performs a regular expression based pattern match. So, if you are familiar with Regular Expressions you can create pattern matches accordingly.&lt;/P&gt;

&lt;P&gt;Following is a run anywhere search to make you understand RegEx based pattern matching.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval URLRedefined="/wcs/resources/products/blah1/blah2/credit/fin/v1?brand=blah1blah2"
| eval URL=case(match(URLRedefined,"/wcs/resources/products/*/credit/fin/v1\?brand=*"),"\/wcs\/resources\/products\/.*\/credit\/fin\/v1\?brand=.*",true(),"UnknownURL"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;While I have taken one random URLRedefined example similar to credit URL you are interested in, you will have access to actual sample and complete data set. Please use regex101 to come up with exact regular expressions and test the same prior to applying the same.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jul 2017 08:49:23 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-07-06T08:49:23Z</dc:date>
    <item>
      <title>Wildcard in middle of search string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291130#M87948</link>
      <description>&lt;P&gt;Hi all , &lt;BR /&gt;
I have this query &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  index=ihs host=losat  sourcetype=ih  ( URLRedefined="/wcs/resources/products/*/credit/fin/v1\?brand=*" OR URLRedefined="/webapp/wcs/OrderItem\?orderId=*")
 | eval URL=case(match(URLRedefined,"/wcs/resources/products/*/credit/fin/v1\?brand=*"),"/wcs/resources/products/*/credit/fin/v1?brand=*",
match(URLRedefined,"/webapp/wcs/OrderItem\?orderId=*"),"/webapp/wcs/OrderItem?orderId=*"  )
         | stats count perc95(ResponseTime)  by URL 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;While running i am getting the stats for the  orderitem   url  but for  credit/fin url  ..no stats are coming  even though data is there for that .&lt;/P&gt;

&lt;P&gt;I can see one msg  in job section:&lt;/P&gt;

&lt;P&gt;Unified Search: The term 'URLRedefined="/wcs/resources/products/&lt;EM&gt;/credit/fin/v1\?brand=&lt;/EM&gt;"' contains a wildcard in the middle of a word or string. This might cause inconsistent results if the characters that the wildcard represents include punctuation.&lt;/P&gt;

&lt;P&gt;How to resolve this ??&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 08:13:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291130#M87948</guid>
      <dc:creator>shabdadev</dc:creator>
      <dc:date>2017-07-06T08:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcard in middle of search string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291131#M87949</link>
      <description>&lt;P&gt;@shabdadev, for the following URL &lt;CODE&gt;"/wcs/resources/products/*/credit/fin/v1\?brand=*"&lt;/CODE&gt;, does asterisk(&lt;EM&gt;) represent wildcard or is asterisk(&lt;/EM&gt;) part of the raw data itself?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 08:22:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291131#M87949</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-07-06T08:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcard in middle of search string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291132#M87950</link>
      <description>&lt;P&gt;asterisk()  &lt;CODE&gt;*&lt;/CODE&gt; is  wildcard   which i want to use  to  take in account all values/data which comes  in between the  both forward slashes&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 08:27:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291132#M87950</guid>
      <dc:creator>shabdadev</dc:creator>
      <dc:date>2017-07-06T08:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcard in middle of search string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291133#M87951</link>
      <description>&lt;P&gt;@shabdadev, you might have to read about &lt;STRONG&gt;match()&lt;/STRONG&gt; function again(&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/ConditionalFunctions#match.28SUBJECT.2C_.22REGEX.22.29"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/ConditionalFunctions#match.28SUBJECT.2C_.22REGEX.22.29&lt;/A&gt;). Match performs a regular expression based pattern match. So, if you are familiar with Regular Expressions you can create pattern matches accordingly.&lt;/P&gt;

&lt;P&gt;Following is a run anywhere search to make you understand RegEx based pattern matching.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval URLRedefined="/wcs/resources/products/blah1/blah2/credit/fin/v1?brand=blah1blah2"
| eval URL=case(match(URLRedefined,"/wcs/resources/products/*/credit/fin/v1\?brand=*"),"\/wcs\/resources\/products\/.*\/credit\/fin\/v1\?brand=.*",true(),"UnknownURL"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;While I have taken one random URLRedefined example similar to credit URL you are interested in, you will have access to actual sample and complete data set. Please use regex101 to come up with exact regular expressions and test the same prior to applying the same.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 08:49:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291133#M87951</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-07-06T08:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcard in middle of search string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291134#M87952</link>
      <description>&lt;P&gt;Hi Niket Thanks for the response...&lt;BR /&gt;
I  think while parsing the  match function it was not able to  parse asterisk  because it was embedded between  2 forward slashes .......i used escape characters in front of the  forward slashes and  asterisk and it worked  . Still i am not sure  why    . (dot)  is used as escape character for  asterisk  ??&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval URL=case(match(URLRedefined,"/wcs/resources/products\/.* \/credit/fin/v1\?brand=*")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The link which you provided , i allready went through it but  in what situations  what all escape characters are used is not mentioned there .&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 09:14:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291134#M87952</guid>
      <dc:creator>shabdadev</dc:creator>
      <dc:date>2017-07-06T09:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcard in middle of search string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291135#M87953</link>
      <description>&lt;P&gt;When I tested with below examples, it worked&lt;/P&gt;

&lt;H4&gt;For brand&lt;/H4&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval URLRedefined="/wcs/resources/products/aaaaaaaaa/credit/fin/v1?brand=hello_world"  
| eval URL=case(match(URLRedefined,"/wcs/resources/products/.*/credit/fin/v1\?brand="),"/wcs/resources/products/*/credit/fin/v1?brand=*",    match(URLRedefined,"/webapp/wcs/OrderItem\?orderId=*"),"/webapp/wcs/OrderItem?orderId=*"  )
| table URLRedefined,URL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H4&gt;For Order item&lt;/H4&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval URLRedefined="/webapp/wcs/OrderItem?orderId=12345"  
| eval URL=case(match(URLRedefined,"/wcs/resources/products/.*/credit/fin/v1\?brand="),"/wcs/resources/products/*/credit/fin/v1?brand=*",   match(URLRedefined,"/webapp/wcs/OrderItem\?orderId=.*"),"/webapp/wcs/OrderItem?orderId=*"  )| table URLRedefined,URL
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The only change, I've done is to use ".*" in the &lt;CODE&gt;match&lt;/CODE&gt; expression.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 09:32:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291135#M87953</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2017-07-06T09:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcard in middle of search string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291136#M87954</link>
      <description>&lt;P&gt;@shabdadev, I think you are confusing between escape character and Regular Expression, &lt;/P&gt;

&lt;P&gt;Dot (.) in Regular expression means pick anything and asterisk (*) will mean repeat n number or time until next pattern is found. RegEx101 towards bottom right section will also give you an idea about Regular Expressions however, I would say better understand that in depth as Regular Expressions will be used for pattern matching in several places and in several Splunk commands/Field Extractions.&lt;/P&gt;

&lt;P&gt;If the comment has helped you resolve the issue. I will convert to answer. Please accept to close the same unless you have any other clarifications.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 09:54:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291136#M87954</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-07-06T09:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcard in middle of search string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291137#M87955</link>
      <description>&lt;P&gt;@shabdadev, please accept the answer if it helped.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 17:06:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Wildcard-in-middle-of-search-string/m-p/291137#M87955</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-07-07T17:06:25Z</dc:date>
    </item>
  </channel>
</rss>

