Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
rami78
New Contributor

URL Filtering / Regular expression

Dear All

 

I want to block all URLs containing our company domain in email format

 

Example lets say my email is rami@xyz.com.jo

 

I want to block all URLs contianing the string @xyz.com.jo

It should be blocked regardless of case

Example http://facss.com/123/page321/?email=user121@xYZ.com.jo 

 

 

 

8 REPLIES 8
AtiT
Valued Contributor

Hello,

I am not a REGEXP expert but you can try:

 

/(.*)\@xyz\.com\.jo(.*)/i

 

 

AtiT

AtiT
rami78
New Contributor

Thank you for your reply however that did not work

AtiT
Valued Contributor

As I said am not a regular expression expert but I think it should work. By the other hand it is not working on FortiGate on my side, I tested it.

 

What worked on my side is set a wildcard URL filter with this: *@xyz.com.jo*

It is case sensitive, so you probably will need to set also something like this: *@xZY.com.jo*

...etc.

 

 

AtiT

AtiT
rami78
New Contributor

I appreciate your efforts Anit. URL filtering is the first thing i tried but its not working either. I wonder if its a bug in hte OS, im running 5.2.10

rwpatterson
Valued Contributor III

Try /.+\@xyz\.com\.jo.*/i

 

() excluded...

+ instead of * (one or more as opposed to zero or more)

Bob - self proclaimed posting junkie!
See my Fortigate related scripts at: http://fortigate.camerabob.com

Bob - self proclaimed posting junkie!See my Fortigate related scripts at: http://fortigate.camerabob.com
mkc2799

.*@xyz\.com\.jo

ede_pfau

Prepending '(?i)' will make a PCRE case-insensitive...might work here. Depends on which flavor of RegEx is supported in FortiOS.

I agree that '@' is not a special character and does not have to be escaped; but '.' has to be. I personally would not match any text which might be included before the RE, just match the RE itself: '(?i)@xyz\.com\.jo'

Ede Kernel panic: Aiee, killing interrupt handler!
Ede Kernel panic: Aiee, killing interrupt handler!
emnoc
Esteemed Contributor III

FWIW

You can test regex  for matches online 

 

https://www.regextester.com/

 

 

edit to tighten it up you could do ;

 

email=[A-Z0-9+_.-]+@xyz\.com\.jo

 

PCNSE 

NSE 

StrongSwan  

PCNSE NSE StrongSwan
Announcements

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Labels
Top Kudoed Authors