MathGroup Archive 2005

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

Search the Archive

Re: string pattern search

  • To: mathgroup at
  • Subject: [mg57362] Re: string pattern search
  • From: bghiggins at
  • Date: Wed, 25 May 2005 06:03:12 -0400 (EDT)
  • References: <d6usff$j2j$>
  • Sender: owner-wri-mathgroup at

Zak, Try regular expressions as for example:

str = "aiibbaecXXacarbiiicc"

StringCases[str, RegularExpression["a[^b]+b[^c]*c"], Overlaps -> All]

{aiibbaec, aecXXacarbiiic, acarbiiic, arbiiic}





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

  • Prev by Date: Re: Sorting nested list
  • Next by Date: Re: Applying a list of functions to a list of arguments
  • Previous by thread: Re: string pattern search
  • Next by thread: Re: string pattern search