cancel
Showing results for 
Search instead for 
Did you mean: 
thelok
Level 7

Usage of String.MatchWildcard

Jump to solution

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?

0 Kudos
1 Solution

Accepted Solutions
McAfee Employee

Re: Usage of String.MatchWildcard

Jump to solution

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,

Jon

edit: missed words

0 Kudos
3 Replies
McAfee Employee

Re: Usage of String.MatchWildcard

Jump to solution

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.Parameters

URL.Domain* is only available in 7.4.2+

Best Regards,
Jon

0 Kudos
thelok
Level 7

Re: Usage of String.MatchWildcard

Jump to solution

What about breaking up IPs into their octets? 1.2.3.4 => [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.

0 Kudos
McAfee Employee

Re: Usage of String.MatchWildcard

Jump to solution

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,

Jon

edit: missed words

0 Kudos