DNS exact match with regex

Hello,
noob question, adding a static DNS entry using regex

/ip dns static add regexp="[*mikrotik*]" address=10.0.0.2

will match everything that contains “MikroTik”, or “myMikroTikDevice.com” , how to match only “mikrotik” and not “myMikroTik” or “mikrotikDevice” ?
Did some tests online and

"^mikrotik$"

shoud be the right forumla, but of course you know better :slight_smile:

Thanks

regex101.com and have a try.

https://regex101.com/r/QPWjwE/1

This should be correct:

/ip dns static add regexp="(^|\\.)guugol\\." address=10.10.10.10

I just discovered that Mac devices are not able to ping .local devices adding static DNS with this formula (^|.)mikrotik.com , due to .local included/added when not TLD is specified, in fact mydevice.mikrotik.com is resolved but not just ping mikrotik or mikrotik.local .

This is more correct?

(^|\.)mikrotik($|\.)

(^|\.)mikrotik\.(com|local)$

Mikrotik alone is not a domain but a hostname, also seen in the hosts file

For a .com domain, this worked for me:

^([a-zA-Z0-9_-]+\.)?DOMAIN\.com