From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1df88f066edd75cb X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-24 11:22:27 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-fra1.dfn.de!news-koe1.dfn.de!RRZ.Uni-Koeln.DE!uni-duisburg.de!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: Pattern Matching Date: Thu, 24 Apr 2003 18:22:26 +0000 (UTC) Organization: GMUGHDU Message-ID: References: <5d8ea641.0304200415.3bf3dccf@posting.google.com> NNTP-Posting-Host: d2-hrz.uni-duisburg.de X-Trace: a1-hrz.uni-duisburg.de 1051208546 10608 134.91.1.15 (24 Apr 2003 18:22:26 GMT) X-Complaints-To: usenet@news.uni-duisburg.de NNTP-Posting-Date: Thu, 24 Apr 2003 18:22:26 +0000 (UTC) User-Agent: tin/1.5.8-20010221 ("Blue Water") (UNIX) (HP-UX/B.11.00 (9000/831)) Xref: archiver1.google.com comp.lang.ada:36493 Date: 2003-04-24T18:22:26+00:00 List-Id: bmsv 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