Only variables that are functions with a specific name pattern need to be removed from the environment
For example, you want to remove all functions that contain code and whose names start with ABC. Yes, this can be easily done with a :foreach loop, but I want to do without it.
Here are the beginnings of designs to help:
(([/system script environment get [/system script environment find name=$i] value]="(code)") or ([:len [:find [/system script environment get [/system script environment find name=$i] value] "(eval"]]>0))
/system script environment remove [find where (name~"^ABC")]
/system script environment remove [find where (name~"^ABC") and ([:typeof]="array")]
Since ( and ) are symbols on regext that start and end one condition, must be escaped with
Since \ is a reserved RouterOS character, must be wrted two times for represent \ on regex