Re: idiom for iterating
Thomas Michael Hagen <[email protected]> Wed, 22 Apr 2009 20:50:45 +0200
| Newsgroups | gmane.mail.spam.crm114 |
|---|---|
| Message-ID | <[email protected]> |
thanks! your way of doing it looks like it should work; matching the whole thing *including* the starting tag first, and then separating out the start tag later. On Wed, Apr 22, 2009 at 7:53 PM, Chris Babcock <[email protected]> wrote: > On Wed, 22 Apr 2009 16:25:43 +0200 > Thomas Michael Hagen <[email protected]> wrote: > >> i have resorted to this clumsy hack: >> >> match (:: :url: :text: :next-url:) [:file:] /(#http:.*?CET >> ....)(.*?)(#http:|$)/ >> isolate (:article:) /:*:url::*:text:/ >> call /:main:/ [:*:article:] >> { >> match <fromnext> (:: :url: :text: :next-url:) [:file:] >> /(#http:.*?CET ....)(.*?)(#http:|$)/ >> isolate (:article:) /:*:url::*:text:/ >> call /:main:/ [:*:article:] >> liaf >> } >> >> there must be a better way than duplicating all that code, right? > > Try "match [:file:] (::) /^/" before going into your loop. That will > position the string pointer to the begining of the variable... or you > can spend some hours combing through your code to see if your opening > marker ended up as part of another match prior to this section of code. > > It's always so much easier to solve others problems than your own. I > have a similar parsing situation involving a flatfile user registration > database that contains user-formated data. Not even all the email > (Email:|E-mail:) fields have the same label! The only field that I can > parse on is the "User:" field at the begining of the record. My first > draft used an idiom like: > > { > match (:: :record:) /(User:.+?)User/ > # Do stuff > alter (:record:) // > liaf > } > > Chris > > > ------------------------------------------------------------------------------ > Stay on top of everything new and different, both inside and > around Java (TM) technology - register by April 22, and save > $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. > 300 plus technical and hands-on sessions. Register today. > Use priority code J9JMT32. http://p.sf.net/sfu/p > _______________________________________________ > Crm114-general mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/crm114-general > > ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p