Mikrotik router Layer7 regexp block access by DNS zones

3.7k Views Asked by At

I trying to make regex for block resources with specific DNS zones only for example .ru

I tried several regex but something Mikrotik router specific and expressions not work...

This list of patterns not work and I not understand why, because in online test tools all work...

^.+(\.ru\/|\.ru$).*$
(\^*.ru$|\^*.ru\/)
^.+(\^*.ru$|\^*.ru\/).*$
^.+(\.ru$|\.ru\/).*$
^(.*ru\/.*|.*ru$.*)$

https://wiki.mikrotik.com/wiki/Manual:Regular_Expressions

https://rubular.com/r/7wS6i3pi6pxJdI

I need help to find what's wrong with expressions in my list

1

There are 1 best solutions below

0
On BEST ANSWER

Regex in mikrotik is a bit simplified, not everything works unfortunately

The solution to your problem:

Regexp:

(\.ru$)|(\.ru\.)

Mikrotik Telminal:

/ip dns static add address=1.1.1.1 regexp="(\\.ru$)|(\\.ru\\.)"

WinBox:

enter image description here