Regex for Numeric Range

Good afternoon,

I want to get the addresses between 192.168.0.0 and 192.168.63.0 through the regex. My regex expression is: “192\.168\.\b([0-9]|[1-5][0-9]|6[0-3])\b”
From what I researched the mikrotik does not support “\b”. So how can I apply the regex?


Any help, I appreciate it.

Compliments,
Daniel Rodrigues

Use “in”: https://wiki.mikrotik.com/wiki/Manual:Scripting#Logical_Operators

MikroTik support POSIX syntax without class (:digit: etc.), do not support other languages syntax
\b is for? word boundaries?

As @msatter wrote, can be used “in” but you do not explain what you needs.

# work because can be specified a group of IPs
:put (192.168.12.54 in 192.168.0.0/18)
:put (192.168.12.54/32 in 192.168.0.0/18)

# do not work because "in" do not accept intervals
:put (192.168.12.54 in 192.168.0.0-192.168.63.0)
:put (192.168.12.54 in 192.168.0.0-192.168.63.255)

This identify an IP

((25[0-5]|(2[0-4]|[01]?[0-9]?)[0-9])\\.){3}(25[0-5]|(2[0-4]|[01]?[0-9]?)[0-9])

But must match only from 192.168.0.0 to 192.168.63.0 keeping the 0 at the end or what is probably wanted, from 192.168.0.0 to 192.168.63.255???

# from 192.168.0.0 to 192.168.63.0 keeping the 0 at the end
(192\\.168\\.(6[0-3]|[1-5]?[0-9])\\.0)

# from 192.168.0.0 to 192.168.63.255
(192\\.168\\.(6[0-3]|[1-5]?[0-9])\\.(25[0-5]|(2[0-4]|[01]?[0-9]?)[0-9]))

Good night,

Thanks for the help @msatter and @rextended.
What I want to do is check if an IP address is present in an LSA Type 1 and if it belongs to that range I mentioned earlier, so I’m using a regular expression.

I solved the problem by putting a dot at the end. My regex expression now is: “192\.168\.([0-9]|[1-5][0-9]|6[0-3])\.”

Thanks for coming back on this and it is a nice solution you got.

I have to say thanks again for the help.