I'm trying to get rows where the value has a match from a defined list of partial strings. Example below.
The partial string which I'm interested is either "aaa" or "aa bb". I've started with the JSL below. Ideally, the result is [1,2,4,5,7,8,11]. The script below was able to get everything except for the last one (11). Nevertheless, perhaps there are more elegant solutions than what I have as well. Appreciate the help!
names default to here(1);
keys_list = {"aaa", "aa bb"};
dt = current data table();
Row_list = dt <<get rows where(contains(keys_list, lowercase(as column("TEST"))));
for(i=1,i<=nrows(dt),i++,
revised_string = lowercase(regex(:Test[i],"\W",",",GLOBALREPLACE));
for(j=1,j<=nitems(keys_list),j++,
if(patmatch(revised_string,keys_list[j]) & nitems(Loc(Row_list,i))==0,
Insertinto(Row_list,i)
)
)
);
show(sort ascending(Row_list))