Re: string pattern search
- To: mathgroup at smc.vnet.net
- Subject: [mg57353] Re: [mg57305] string pattern search
- From: Igor Antonio <igora at wolf-ram.com>
- Date: Wed, 25 May 2005 06:03:02 -0400 (EDT)
- Organization: Wolfram Research, Inc.
- References: <200505240912.FAA19158@smc.vnet.net>
- Reply-to: igora at wolf-ram.com
- Sender: owner-wri-mathgroup at wolfram.com
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
1 -
StringCases["aiibbaecXXacarbiiicc",
ShortestMatch["a" ~~ ___ ~~ "b" ~~ ___ ~~ "c"], Overlaps -> False]
2 -
StringCases["aiibbaecXXacarbiiicc",
ShortestMatch["a" ~~ ___ ~~ "b" ~~ ___ ~~ "c"], Overlaps -> True]
--
Igor Antonio
Wolfram Research, Inc.
http://www.wolfram.com
To email me personally, remove the dash.
- References:
- string pattern search
- From: zak <chocolatez@gmail.com>
- string pattern search