Peter,
I'm a little confused as to which of the results you don't want. You
indicate the second line, but you state in the example that it's "OK".
I am not sure if that is a bug or not, but you can simply work around it
by doing a replace before doing the parse. The only drawback is you
will also have to do a replace to get the " back if they are needed.
test: parse/all replace/all {2008-10-30|"This is"
NOK|http://www.example.com} {"} {~} "|"
Here, the replace <your string> {"} {~} will occur prior to the
parse. =20
=3D=3D ["2008-10-30" {~This is~ NOK} "http://www.example.com"]
The end result will need to have the ~ character replaced with " if they
are essential.
replace/all test/2 {~} {"}
=3D=3D {"This is" NOK}
Or you can do the replace directly into the block like so...
>> test/2: replace/all test/2 {~} {"}
=3D=3D {"This is" NOK}
>> test
=3D=3D ["2008-10-30" {"This is" NOK} "http://www.example.com"]
I hope this helps work around the problem.
Brock
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Peter Carlsson
Sent: October 30, 2008 8:53 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] Problem with parse
Hello!
I have a databasefile built up by lines with the following structure:
{<date>|<string>|<url>
I parse each line using:
parse/all <line> "|"
This normally works as expected but with the second line below it seems
like the parse does something wrong. Or do I miss something?
>> parse/all {2008-10-30|This is OK|http://www.example.com} "|"
=3D=3D ["2008-10-30" "This is OK" "http://www.example.com"]
>> parse/all {2008-10-30|This "is" OK|http://www.example.com} "|"
=3D=3D ["2008-10-30" {This "is" OK} "http://www.example.com"]
>> parse/all {2008-10-30|"This is" NOK|http://www.example.com} "|"
=3D=3D ["2008-10-30" "This is" " NOK" "http://www.example.com"]
It seems that the problem is when a | is directly followed by a ".
Anyone with a solution?
Best regards,
Peter Carlsson
--
To unsubscribe from the list, just send an email to lists at rebol.com
with unsubscribe as the subject.
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.