Community discussions

MikroTik App
 
faysalsy
just joined
Topic Author
Posts: 5
Joined: Tue Oct 01, 2019 6:53 pm

Find a comment that doesn't contain a specific text

Mon Mar 14, 2022 9:56 pm

How to find a comment that doesn't contain a specific text
 /ip hotspot user [ find comment~"a" ]
But I want to find a comment that doesn't contain the text "a" for example.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3291
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Find a comment that doesn't contain a specific text

Mon Mar 14, 2022 10:03 pm

/ip hotspot user find comment!~"a" 
~ Does contain
!~ Does not contain
NB do not use [] in the way you did.

You can also mix and match:
/ip hotspot user find comment!~"a" comment~"b"
to get result to a variable:
:local test [/ip hotspot user find comment!~"a" comment~"b"]
 
faysalsy
just joined
Topic Author
Posts: 5
Joined: Tue Oct 01, 2019 6:53 pm

Re: Find a comment that doesn't contain a specific text

Mon Mar 14, 2022 10:13 pm

{
:loc d [/system clock get date];
 :local mo [:pick $d 0 3];
/ip h u remove [ find  comment!~ "$mo" ]
}
dont work

but if
{
:loc d [/system clock get date];
 :local mo [:pick $d 0 3];
/ip h u remove [ find  comment~ "$mo" ]
}
it work
 
User avatar
eworm
Forum Guru
Forum Guru
Posts: 1070
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Find a comment that doesn't contain a specific text  [SOLVED]

Mon Mar 14, 2022 11:55 pm

/ip hotspot user print where !(comment~"a")

Who is online

Users browsing this forum: No registered users and 32 guests