Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Parsing Exercise

From: edoconnor::gmail::com at: 1-Sep-2005 17:15

This string processing exercise is taken from the post: http://discuss.joelonsoftware.com/default.asp?design.4.195596.22 Begin ////////////////////////// Given a text number of the follwing format: AH-1-1 Or AH-1-1G Or AH-1-G1 During data entry, we want the number code of the last part (token) to increment by one. So, if you pass the above values, you get AH-1-1 --> AH-1-2 --> AH-1-3 AH-1-1G --> AH-1-2G --> AH-1-3G AH-1-G1 --> AH-1-G2 --> AH-1-G3 ////////////// End I posted a REBOL version, but I'm not terribly gifted at writing parse rules. I'd be curious to see how other REBOLers might handle it. Of course, if you have an approach that is elegant and/or terse, reply to the orginal poster. Regards, Ed