Using scriting to remove things

There is no need to attack here. OP did run into a corner case in remove [find], so yes a bit of discussion is normal. But quibbling is bit much.

As noted, numbers= is implied. It's need sometimes in REST API. Nothing, per se, wrong in using it. Just more verbose, and less clear to readers IMO.

But the topics="dhcp;info" part does solve the exactness problem in regex. Assuming RouterOS maintains the order, which AFAIK it should but who knows

It's a shame that anyone can read what's written on the forum,
and saying I told a third lie is nonsense, devoid of any logical reason.

Staying in cat-like style...

Come on, let's stop now, even for the next time.
If you want help, and you feel worthy of accepting it, ask (in what I know, obviously).

No one @Amm0 is involved on the image :rofl:

If it’s an array it’d be counterintuitive if it didn’t; but thanks for pointing out the possibility. All in all I found responses very instructive to gain a wider understanding, not just in solving the imminent issue. So thanks y’all again.

1 Like

One more for educational purposes. Part of the underlying issue is there no "is member of" operator for arrays.

There is :find (which is different from / find). So this also work, for even crazier example:

/system/logging remove [find [:find $topics "dhcp"]>-1 [:find $topics "info"]>-1]

Background is find on a command is a iterator of the "list" of the current command, while :find will get an index from a string or array type.

I've argued that in should work with array too, so there is boolean to check if a item is inside an array variable, like "dhcp" in topics, instead in just operates on ip address type like (192.168.88.4 in 192.168.88.0/24)

FWIW, I filed a feature request to add comment= to /system/logging (SUP-208069), since MirkoTik has been fixing up scripting recently (:tobool "true" :wink: ). IMO all config items should support comment= to allow easy matching in a find. And most do support comment= these day... somehow this one escaped anyones notice My defense is like @rextended, I have custom defconf's that only add, and then use winbox for any one-off logging things