cancel
Showing results for 
Search instead for 
Did you mean: 
haaris
Level 10

Use of Regular Expression in Webgateway

I dont have much idea about use of regular expression  in  webgateway like / \ . |  ? etc.

Can anyone help me with the meaning of different types o regulare expression..

For eg. regular expression like regex(^htt(p|ps):\/\/([\w.-]*\.|\.?)mcafee\.com(\/.*|\/?))

0 Kudos
7 Replies
btlyric
Level 12

Re: Use of Regular Expression in Webgateway

I suggest http://www.regexbuddy.com/

Inexpensive and very useful.

0 Kudos
eelsasser
Level 15

Re: Use of Regular Expression in Webgateway

This is what RegexBuddy looks like:

Capture.png

However, i would also suggest that you don't need to use a lot of these regular expressions with the introduction of properties like URL.Host.BelongsToDomains(<list>) or

URL.SmartMatch(<list>)

0 Kudos
asabban
Level 17

Re: Use of Regular Expression in Webgateway

For performance reasons you may want to prevent the usage of regular expressions whenever possible. There are only rare cases where regular expressions need to be used, most use cases can be covered by the properties Erik mentioned or using GLOB expressions (which is basically like *.mcafee.com, so easy to read).

For regular expressions there are tons of tutorials or papers on the internet, or even books. If you have few experience with regular expressions try to avoid them and/or make yourself familiar with them before using the,. They can become a performance killer if used in an incorrect way.

Best,

Andre

0 Kudos
McAfee Employee

Re: Use of Regular Expression in Webgateway

Hi Haaris,

I agree with Andre on this one.

If you are not familiar with regex, then there are plenty of other properties (URL.Host, URL.HostBelongsToDomains, URL.Domain, URL.SmartMatch) you can use that do not require extensive knowledge of regex. Additionally regex can become a performance issue if overused.

As far as regex tools go for learning, I love regexr as mentioned by

Best Regards,

Jon

0 Kudos
trishoar
Level 11

Re: Use of Regular Expression in Webgateway

There is also http://www.regexr.com/ which looks a bit like RegexBuddy but is free. I use that a fair bit when doing complex stuff.

Tris

0 Kudos
haaris
Level 10

Re: Use of Regular Expression in Webgateway

Thanks everyone for their support....

So,it means that regular expression doesnt have much importance

0 Kudos
asabban
Level 17

Re: Use of Regular Expression in Webgateway

This depends on what you are doing!

For simple things like "Block a user from accessing a specific URL" usually you do not need regular expressions.

But since MWG allows a lot of functionality there are reasons  when regular expressions are very handy. They simple allow much more control about strings than the properties or glob expressions provide. As mentioned they should only be used when there is no alternative.

Best,

Andre

0 Kudos