$wildtok
From Scriptwiki
Returns the Nth token that matches the wildcard string.
$wildtok(tokens,wildstring,N,C)
Note that if you specify zero for N, it returns the total number of matching tokens.
Example
var %mytext = fish cow cat dog sheep var %number_of_matches = $wildtok(%mytext,*o*,0,32) echo -a %number_of_matches var %i = 1 while (%i <= %number_of_matches) { echo -a $wildtok(%mytext, *o*, %i ,32) inc %i }
This example would at first echo the number of matches, so 2, as an o is in cow and dog, then echo these tokens using a while loop.
This is an example to check if a channel name has been said in a varible or string, useful for anti-advertising scripts.
on *:text:*#*:#: { if ($wildtok($1-,#?*,0,32) >= 1) echo -ag You're advertising $nick and thats not allowed! }