I have a file full of lines like this:
Gen1:30 blah blah blah
2Pet3:4 blah blah blah
I want to extract that first word, and split it up as follows:
Gen1:30 becomes ("Gen" "1" "30")
2Pet3:4 becomes ("2Pet" "3" "4")
I've played with parse a bit, but I'm flummoxed on this one.
I've made some progress with this:
(parse ((parse str " ") 0) ":")
Which yields ("Gen1" "30")
Is this a job for (regex)?
UPDATE: I played with regex and got what I needed.
(regex {^(.[[:alpha:]]+)(d+):(d+)}) mystring)
Ted
parse divides the text and 'consumes' the delimiters (or throws them away, if you like!). There's no delimiter between the "Gen" and the "1", so it would be difficult to use parse.
find-all is worth looking at too:
(dolist (v '({Gen1:30 blah blah blah} {2Pet3:4 blah blah blah}))
(find-all {(.*?)(d+):(d+)} v (set 'b $1 'b $2 'v $3) 0)
(println {Book } v { Chapter } c { Verse } c)
)