function z=regexplist(list1,list2) % returns boolean vector indicating whether any regular expression of cell % array list1 is a member of list2. % % See also REGEXP % % Joshua V. Dillon; Feb. 20, 2007; jvdillon AAT purdue DDOT edu % jvd: surround each c1label with parens and put a '|' between them ptrn = [ repmat({'('},1,length(list1)); ... list1; repmat({')|'},1,length(list1)-1) {')'} ]; % jvd: ensure it is a complete match ptrn = ['^' cell2mat(reshape(ptrn,1,3*numel(list1))) '$']; % jvd: perform regex and return logical z = ~cellfun(@isempty,regexp(list2,ptrn)); %% inverse string search? % ~cellfun(@isempty,regexp(list2,'(?!' ptrn '\>)\<.+'));