; syntax: /delhashtokens *a*wildc?rd-expres*n
alias delhashtokens {
; put the name of your hash table here
var %t = TABLENAME
; create a regular expression ouf of the "wildcard"-word $1.
; the expression should only match lines that contain any "word" wildmatching your expression - in contrast to a "line" wildmatching your expression.
; ( it quotes $1 so no text char is treated as "metachar", replaces the wildcards */? with regex-equivalents, and adds lookarrounds to match like a $istok(,32) )
var %ex = $+(/,(?<=^|\s)\Q,$replacexcs($$1,*,\E\S*\Q,?,\E\S\Q,\E,\E\\E\Q),\E(?=\s|$),/)
; loop all items matching the regular expression
var %n = $hfind(%t,%ex,0,r).data
while (%n > 0) {
; the current item and it's data
var %item = $hfind(%t,%ex,%n,r).data, %data = $hget(%t,%item)
; find and remove all the "words" from the data that wildmatch the original expression
while ($wildtok(%data,$1,1,32)) { var %data = $deltok(%data,$findtok(%data,$v1,1,32),32) }
; delete item if no data is left or save the new data
$iif((%data == $null),hdel,hadd) %t %item %data
; proceed with next item
dec %n
}
}