MathGroup Archive 2005

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

Search the Archive

Re: string pattern search


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