Ever wanted to see if you can match any word in a group with any word in another group with an unspecified number of words?
This does it for you, usage explained below.
; $anytok(text,text to search).prop <-- Searches all of the unspecified amount of text in 'text' for at least 1 match in 'text to search'. PROP << Must be specified as one of the below.
; Usage:
; $anytok(text,text to search,N).all <-- Returns every word matched
; $anytok(text,text to search,N).num <-- Returns numerically, the number of matches found
; $anytok(text,text to search,N).true <-- Returns $true if there is at least one match and $false if there is not one
; Examples:
; $anytok(hi this is good,hi how are you,32).num <-- Returns '1'. .all would return "hi" and .true would return $true
; $anytok(text,text to search).prop <-- Searches all of the unspecified amount of text in 'text' for at least 1 match in 'text to search'. PROP << Must be specified as one of the below.
; Usage:
; $anytok(text,text to search).all <-- Returns every word matched
; $anytok(text,text to search).num <-- Returns numerically, the number of matches found
; $anytok(text,text to search).true <-- Returns $true if there is at least one match and $false if there is not one
; Examples:
; $anytok(hi this is good,hi how are you).num <-- Returns '1'. .all would return "hi" and .true would return $true
alias anytok {
if ($isid) {
var %x 0
while (%x < $numtok($1,$3)) {
inc %x
$iif($istok($2,$gettok($1,%x,$3),$3),set %z %z $gettok($1,%x,$3),)
}
var %t %z | unset %z
$iif($prop == num,return $numtok(%t,$3),)
if ($prop == true) {
$iif(%t,return $true,return $false)
}
$iif($prop == all,return %t,)
}
}