MathGroup Archive 2005

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

Search the Archive

Re: string pattern search

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57375] Re: string pattern search
  • From: dh <dh at metrohm.ch>
  • Date: Thu, 26 May 2005 04:31:19 -0400 (EDT)
  • References: <d6usff$j2j$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Zak,
see below.
Sincerely, DAniel

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}
StringCases["aiibbaecXXacarbiiicc", "a" ~~ Except["b"] ... ~~ "b" ~~ 
Except["c"] ... ~~ "c"]
> 2-and when we consider overlapping:
> {aiibbaec},{aecXXacarbiiic},{acarbiiic},{arbiiic}
StringCases["aiibbaecXXacarbiiicc", "a" ~~ Except["b"] ... ~~ "b" ~~ \
Except["c"] ... ~~ "c", Overlaps -> All]
> 
> regards
> 


  • Prev by Date: Re: least-squares problem: B ~ X.A
  • Next by Date: Re: How to get decent quality plots.
  • Previous by thread: Re: string pattern search
  • Next by thread: MathLink and GUIKit