MathGroup Archive 2005

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

Search the Archive

Re: about PATTERNS

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53560] Re: [mg53548] about PATTERNS
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Tue, 18 Jan 2005 05:08:00 -0500 (EST)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

str="1223322176644667983323456554";

Module[{
    t=StringCases[str,a_~~b_~~b_~~c_/;a?b?c]},
  DeleteCases[t,Complement[t,StringReverse[t] ]]]

{1223,3221,7664,4667,8332,6554}


Bob Hanlon

> 
> From: "George peite" <rasan1988 at hotmail.com>
To: mathgroup at smc.vnet.net
> Date: 2005/01/16 Sun PM 10:24:05 EST
> To: mathgroup at smc.vnet.net
> Subject: [mg53560] [mg53548] about PATTERNS
> 
> In[1]:= str = "1223322176644667983323456554";
> 
> In[2]:= StringCases[str, a_ ~~ b_ ~~ b_ ~~ c_ /; a != b != c]
> 
> Out[2]= {1223, 3221, 7664, 4667, 8332, 6554}
> 
>   the above code will extract the pattern  abbc  from the above string, but 
> how i could put a rule to just display the substrings wich match this 
> pattern and also have an inverted form in the main string so the output will 
> give the following:
> 
> Out[2]= {1223, 3221, 7664, 4667}
> 
> thanks
> George peite
> 
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE! 
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> 
> 


  • Prev by Date: Re: GUIKit: <<file quirk
  • Next by Date: Re: GUIKit: <<file quirk
  • Previous by thread: Re: about PATTERNS
  • Next by thread: Re: about PATTERNS