MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Searching for multiple strings in a list

  • To: mathgroup at
  • Subject: [mg86280] Searching for multiple strings in a list
  • From: "Coleman, Mark" <Mark.Coleman at>
  • Date: Fri, 7 Mar 2008 02:30:54 -0500 (EST)


I'm doing some work with very long lists of strings. As part of the
effort I need to identify strings that contain all of set of keywords
(regardless of order) that a user may specify. The function StringCases
will take multiple keywords as an argument, but it will return a list
giving those elements that contain any one of the keywords, not *all* of
the keywords. I know this can be done using multiple calls to
StringCases and comparing the results for each keyword, but this seems
very cumbersome, particularly if there are many keywords specified.

Any help would be most appreciated.



  • Prev by Date: Re: Apply function to parts of a list
  • Next by Date: Re: Assignment problem
  • Previous by thread: Re: Methods for plotting
  • Next by thread: Re: Searching for multiple strings in a list