From: Georg Bauhaus <sb463ba@d2-hrz.uni-duisburg.de>
Subject: Re: Pattern Matching
Date: Thu, 24 Apr 2003 18:22:26 +0000 (UTC)
Date: 2003-04-24T18:22:26+00:00 [thread overview]
Message-ID: <b89a12$abg$1@a1-hrz.uni-duisburg.de> (raw)
In-Reply-To: 5d8ea641.0304200415.3bf3dccf@posting.google.com
bmsv <temp2@dagi3d.net> wrote:
: This an example string I have:
: city[hotel1,hotel2,hotel3]{restaurant1, restaurant2}
: the line could also look like this:
: city{restaurant1, restaurant2}[hotel1,hotel2,hotel3]
What I would do is:
Use Regpat to extract the groups, that is,
city match(1).first .. match(1).last
restaurant1, restaurant2 match(2).first .. match(2).last
hotel1,hotel2,hotel3 etc.
For this, a Match_Array object of Parent_Count length will
suffice. (You can use three groups in an alternative
reflecting the order of {} and [], or a pattern involving
[{[]([^]}]*)[]}], if input is wellformed, or similar.)
Then, split the groups into data structures of your choice,
eg sets.
Using Find_Token and related subprograms from Ada.Strings.Fixed
might be an alternative.
just my 2c
-- Georg
next prev parent reply other threads:[~2003-04-24 18:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-20 12:15 Pattern Matching bmsv
2003-04-24 18:22 ` Georg Bauhaus [this message]
-- strict thread matches above, loose matches on Subject: below --
1997-10-07 0:00 Pattern matching Neil Goodgame
1997-10-08 0:00 ` Matthew Heaney
1997-10-09 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox