[REBOL] Re: Need help from parsing professionals
From: sqlab:gmx at: 27-Jul-2001 12:48
> it is obviously not a big thing.
> I have a big string. from this string i need to make a readable file with
> lots of lines. So every line starts with AA......
> The Line ends when the next Line with AA comes up.
> What i tried now was following:
> a: read %/c/temp/test.txt
> parse a [any [to "AA201" mark: to "AA" (write/append %/c/temp/new.txt join
> mark "^/")]]
> This seems to run in an endless loop and looking in the new.txt it shows,
> that the parser didn't recognise the "AA201", because he always adds the
> whole big string in one part, not the parts of the string as lines.
At first you should advance the focus as in
to "AA201" mark: skip 2 to "AA"
mark sets only a pointer in the string, so your next write/append appends
always from this point until the end of the string.
Of course you could use a copy to or a copy/part with a second pointer.
But why do you not just replace/all next a "AA201" "^/AA201" ?
GMXler aufgepasst - jetzt viele 1&1 New WebHosting Pakete ohne
Einrichtungsgebuehr + 1 Monat Grundgebuehrbefreiung!