Hello Peter!

I don't have the answer to why you're third case doesn't work but have  
this parse-it-yourself solution that seems to give the result you are  
seeking. I'm sure there are many better ways to do what you want  and  
hopefully others will chip in with them.

 >> parse-rule: [
[    2 [copy data to "|" skip (insert/only tail parse-output data)]
[    copy data to end (insert/only tail parse-output data)
[    ]

You will need to use it like this:

 >> parse-output: copy []
== []
 >> line: {2008-10-30|This is OK|http://www.example.com}
== "2008-10-30|This is OK|http://www.example.com";
 >> parse/all line parse-rule
== true
 >> head parse-output
== ["2008-10-30" "This is OK" "http://www.example.com";]



 >> parse-output: copy []
== []
 >> line2: {2008-10-30|This "is" OK|http://www.example.com}
== {2008-10-30|This "is" OK|http://www.example.com}
 >> parse/all line2 parse-rule
== true
 >> head parse-output
== ["2008-10-30" {This "is" OK} "http://www.example.com";]


 >> parse-output: copy []
== []
 >> line3: {2008-10-30|"This is" NOK|http://www.example.com}
== {2008-10-30|"This is" NOK|http://www.example.com}
 >> parse/all line3 parse-rule
== true
 >> head parse-output
== ["2008-10-30" {"This is" NOK} "http://www.example.com";]

Regards

Peter

On 30 Oct 2008, at 20:52, Peter Carlsson wrote:

> 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} "|"
> == ["2008-10-30" "This is OK" "http://www.example.com";]
>
>>> parse/all {2008-10-30|This "is" OK|http://www.example.com} "|"
> == ["2008-10-30" {This "is" OK} "http://www.example.com";]
>
>>> parse/all {2008-10-30|"This is" NOK|http://www.example.com} "|"
> == ["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.

Reply via email to