MathGroup Archive 2010

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

Search the Archive

Re: StringCases matching on portions of sublist?


On 1/20/10 at 6:47 AM, jasonbrent at gmail.com (Jason Ledbetter) wrote:

>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}}

<attempt using StringCases snipped>

Instead of StringCases use Cases as follows:

In[2]:= Cases[z, {_?(StringMatchQ[#, "*Nov*"] &), __}]

Out[2]= {{"Thu Nov 19 12:09:23 GMT 2009", 7492, 0, 0}}



  • Prev by Date: Function and object naming conventions
  • Next by Date: Astrophysical Data Selection
  • Previous by thread: StringCases matching on portions of sublist?
  • Next by thread: Re: StringCases matching on portions of sublist?