[SOLVED] FIND with WILDCARD syntax HELP required

Greetings,

I wan to print (:log info) all hotspot users account who DO NOT have word “special” in comments.

For example, Currently users have following comments:
user1 = special library
user2 = special xyz garden
user3 = 123 special lobby
user4 = ordinary single
user5 = double ordinary

Now I want to print only users name who DONOT have special in there comments section.
I am trying with this with no luck :frowning:

:local username
:foreach i in=[/ip hotspot user find] do {
:set username ( username [ip hotspot user get $i name])
:if ([/ip hotspot user get [/ip hotspot user find name=$username] comment ] ~"special") do {
:log warning "$username..."
}}}}}

The above script print users who have “special” in there comments, but I want opposite of it, i want to print name of users who donot have word"special" in the comments.
howto correct?

print where !(name~“special”)

I couldn’t get :if !() to work, it just gives syntax errors.

You could simply use else{}, something like this:
/ip hotspot user

:foreach i in=[find] do={
:local username [get $i name]
:if ([get $i comment]~“special”) do={
} else={
:log warning “$username…”
}
}

Thanks Mr. Scot & mrz,

I tried Scot method and it worked like a charm :smiley:
Solved !