3 Replies Latest reply on Feb 11, 2015 2:01 PM by Jon Scholten

    Usage of String.MatchWildcard


      I am using MWG 7.3.2, the description for using String.MatchWildcard when searching for it in WebGateway is:


      Returns a list with matched expressions of a given string, for example property with string "http://www.google.de" and regular expression "/(ftp|http|https):\/\/(\w+)*\.(\w+\.)*(\w+)*/" will return a list with the elements 'http', 'www', 'google.', 'de'


      However when I put in the parameters with http://www.google.de as the first parameter and /(ftp|http|https):\/\/(\w+)*\.(\w+\.)*(\w+)*/ as the second parameter I get no results. I've tried different combinations such as using *google* or regex(...) but I never get any results. The product documentation shows that String.MatchWildcard has 3 parameters but in the MWG it only allows 2 parameters.


      Does anyone know the proper syntax and have an example of something that breaks down a URL into different components?

        • 1. Re: Usage of String.MatchWildcard
          Jon Scholten

          Hi thelok,


          Why reinvent the wheel? There are already properties for this:

          URL.Protocol = http

          URL.Host = www.google.com

          URL.Domain = google.com

          URL.DomainSuffix = com

          URL.Path = /



          URL.Domain* is only available in 7.4.2+


          Best Regards,

          • 2. Re: Usage of String.MatchWildcard

            What about breaking up IPs into their octets? => [1, 2, 3, 4]


            I can use String.find() and String.substring() but was hoping to use String.MatchWildcard() to do that, otherwise that's alot of variables to keep track of and alot of string manipulation.

            • 3. Re: Usage of String.MatchWildcard
              Jon Scholten

              Hi thelok,


              Again you're making too much work for yourself!


              String.ToListOfString is your friend. You must first cast the IP as a string first (IP.ToString).


              CustomListOfString = String.ToStringList(IP.ToString(URL.Destination.IP)), ".", "\t\n\r")


              List.OfString.Get(CustomListOfString, 0)

              List.OfString.Get(CustomListOfString, 1)

              List.OfString.Get(CustomListOfString, 2)

              List.OfString.Get(CustomListOfString, 3)


              Best Regards,



              edit: missed words