Re: about PATTERNS
- To: mathgroup at smc.vnet.net
- Subject: [mg53564] Re: about PATTERNS
- From: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>
- Date: Tue, 18 Jan 2005 05:08:05 -0500 (EST)
- References: <csfffb$6gn$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
This will do what you want: str = "1223322176644667983323456554"; s1=StringCases[str, a_ ~~ b_ ~~ b_ ~~ c_ /; a != b != c]; s2=Map[StringReverse,s1]; Intersection[s1,s2] Steve Luttrell "George peite" <rasan1988 at hotmail.com> wrote in message news:csfffb$6gn$1 at smc.vnet.net... > 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/ >