Re: about PATTERNS
- To: mathgroup at smc.vnet.net
- Subject: [mg53552] Re: [mg53548] about PATTERNS
- From: DrBob <drbob at bigfoot.com>
- Date: Tue, 18 Jan 2005 05:07:51 -0500 (EST)
- References: <200501170324.WAA05950@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
str="1223322176644667983323456554"; StringCases[str,a_~~b_~~b_~~c_/;(a != b != c)] Select[%,MemberQ[%,StringReverse@#]&] {1223,3221,7664,4667,8332,6554} {1223,3221,7664,4667} or Intersection[StringCases[str,a_~~b_~~b_~~c_/;(aâ? bâ? c)],StringCases[\ StringReverse@str,a_~~b_~~b_~~c_/;(a != b != c)]] {1223,3221,4667,7664} or (better, I think): StringCases[str,a_~~b_~~b_~~c_/;(a != b != c)] Intersection[%,StringReverse/@%] {1223,3221,7664,4667,8332,6554} {1223,3221,4667,7664} Bobby On Sun, 16 Jan 2005 22:24:05 -0500 (EST), George peite <rasan1988 at hotmail.com> wrote: > 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/ > > > > -- DrBob at bigfoot.com www.eclecticdreams.net
- References:
- about PATTERNS
- From: "George peite" <rasan1988@hotmail.com>
- about PATTERNS