Re: string pattern search
- To: mathgroup at smc.vnet.net
- Subject: [mg57362] Re: string pattern search
- From: bghiggins at ucdavis.edu
- Date: Wed, 25 May 2005 06:03:12 -0400 (EDT)
- References: <d6usff$j2j$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Zak, Try regular expressions as for example: str = "aiibbaecXXacarbiiicc" StringCases[str, RegularExpression["a[^b]+b[^c]*c"], Overlaps -> All] {aiibbaec, aecXXacarbiiic, acarbiiic, arbiiic} StringCases[str,RegularExpression["a[^b]+b[^c]*c"]] {aiibbaec,acarbiiic} Cheers, Brian zak wrote: > Hi > how to search for the pattern "abc" in the string "aiibbaecXXacarbiiicc" > and the letters space between a,b,c is not important, so the output will be: > 1-when overlapping not allowed: > {aiibbaec},{acarbiiic} > 2-and when we consider overlapping: > {aiibbaec},{aecXXacarbiiic},{acarbiiic},{arbiiic} > > regards