(* Selecting pictures taken in Texas *) maintainSelectTexas := Module[{pics, capt, capt1, capt2}, pics = topic /@ Range[mmmpics]; Print["----- Selecting pictures taken in Texas from all ", Length[pics], " pictures ..."]; pics = Select[pics, MemberQ[yearsTexas, ToExpression[#[[1]]]] &]; Print["Selected ", Length[pics], " pictures taken in years ", yearsTexas // Short]; pics = Transpose[Take[Transpose[pics], -2]]; file = FileNameJoin[{dirwork, "excludephrases.txt"}]; checkfile[file]; excludePhrases = Import[file, "Lines"]; excludePhrases = Select[StringTrim/@excludePhrases, (# =!= "")&]; Print["The following phrases will be excluded: ", excludePhrases]; picsTexas = Select[pics, ( capt = picCaption @@ #; capt1 = StringReplace[capt, RegularExpression["\\W"] -> " "] // stringtrim // StringSplit; capt2 = If[Length[capt1] >= 4, capt1[[-4]], ""]; capt2 === "Texas" && StringFreeQ[capt, excludePhrases, IgnoreCase -> True]) &]; Print["Selected ", Length[picsTexas], " pictures taken in Texas."]; ];