Re: splitting sublists
- To: mathgroup at smc.vnet.net
- Subject: [mg58135] Re: splitting sublists
- From: "dkr" <dkrjeg at adelphia.net>
- Date: Sun, 19 Jun 2005 03:43:56 -0400 (EDT)
- References: <d8rjme$isb$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
What you appear to want to do is find the longest sequence of integers
preceding each "x", enclose the sequence in a list, and delete the "x".
In[4]:=
{{3,1,4,"x",1,5,9,2,"x"},{6,5,
"x",3,5,"x",8,9,"x"}}//.{a___?(!IntegerQ[#]&),
b__Integer,"x",c___}:>{a,{b},c}
Out[4]=
{{{3,1,4},{1,5,9,2}},{{6,5},{3,5},{8,9}}}