help find lease by comment

Trying to find by incomplete comment ROS 5.15:

ip dhcp-server lease print where comment=“customer”

but full comment is “customer 0001 blablabla”,“customer 0002 blablabla”, when using command above,- shows nothing.
but when comments only such as “0001”,“0002”, and I searching only that strings, they showed well.

From winbox can use filter with feature “comment” “contains” “customer 0002”, and it work showing me right I search (“customer 0002 blablabla”), when searching by “customer” it shows all records started with customer.

Need help to complete command.

Yes, you can do that.

Read this:

http://wiki.mikrotik.com/wiki/Manual:Scripting


Within that page, search for “substring”

Try:

/ip dhcp-server lease print where comment~"customer"

Thank you ! skillful You save me a lot of time :slight_smile:

But it doesn’t work thrue PHP API, this ~ must be something different.

/ip/dhcp-server/lease/print
?comment**~**customer

Not working.

You could try

?>comment=customer

But that should only work if the comment starts with “customer”. It surely won’t work if the word is in the middle of the comment.

caugh

so understand, this must be putted in WIKI, in manual API as a restricted substring feature …

Have you actually tried this (I haven’t)?

I based my “in the dark shot” on the API page, where one of the query examples is

Get all routes that have non-empty comment:

/ip/route/print
?>comment=

>