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

[REBOL] Re: newbie parsing question

From: arolls:bigpond:au at: 4-Mar-2001 14:23

> I've got an <IMG SRC=""> tag, and I'd like to parse the filename > in the SRC > attribute. > The format of the filename is : /some-path/AAA00000s0.jpg or > /some-path/AAA00000s00.jpg where A is a character [A-Z], and 0 > represents > a digit. I want to grab the one or two digits following the 's'.
a: "/some-path/AAA00000s12.jpg" parse a [some [thru "/"] copy filename thru ".jpg"] ; get the filename filename ;== "AAA00000s12.jpg" Now extend the above to parse the filename: alpha: charset "ABCDEFGHIJKLMNOPQRSTUVWXYZ" digit: charset "0123456789" parse a [some [thru "/"] copy filename thru ".jpg" (parse filename [3 alpha 5 digit "s" copy n to "."])] n ;== "12" Regards, Anton.