Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

StringCases matching on portions of sublist?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106646] StringCases matching on portions of sublist?
  • From: Jason Ledbetter <jasonbrent at gmail.com>
  • Date: Wed, 20 Jan 2010 06:47:08 -0500 (EST)

Folk,

I'm trying to write a function to narrow down some data by timestamp but I'm
having some trouble getting this to work.

My data is a list of lists with the first member of each sublist being a
date stamp. I was hoping to use StringCases to match but I'm apparently
missing something here.

Example data is as follows:

z={{"Thu Nov 19 12:09:23 GMT 2009", 7492, 0,
  0}, {"Thu Jan 07 13:48:21 GMT 2010", 9225, 3,
  0}, {"Thu Dec 17 09:30:52 GMT 2009", 8735, 1, 0}}


I've tried the following:


StringCases[z, {"*Nov",___}]


which returns:


String or list of strings expected at position 1 in StringCases. This makes
sense to me.. so I tried:


StringCases[z[[All,1]], ___~~Nov~~___]


which returns:


{{"Thu Nov 19 12:09:23 GMT 2009"}, {}, {}}


How can this be modified to return the full sublist where the first element
of the sublist matches a string pattern?


-jbl



  • Prev by Date: Re: Replace list element based on a condition how to
  • Next by Date: Re: Replace list element based on a condition how to
  • Previous by thread: Re: Pagination when transferring Mathematica docs to PDF
  • Next by thread: Re: StringCases matching on portions of sublist?