Hi Giuseppe,
does the following script help you a bit?
Kind regards,
Arie
=================================== script follows
=============================================
rebol []
example1: {
Name: John
Surname: Doe
Book: Private America
1stPubblication: 1950
Brief description: oo xx oo xx oo xx
}
example2: {
Name: Jane
Surname: Doe
Height: 1.75m
Eyes: Brown
Hair: Blonde
Hobbies: Play Tennis, Swim, Music
Book: Private Women of America
1stPubblication: 1950
Brief description: oo xx oo xx oo xx Woman
}
rule: [
thru "Name: "
copy name
to "^/"
(print ["Name: " name])
thru "^/"
thru "Surname: "
copy surname
to "^/"
(print ["Surname: " surname])
thru "^/"
0 1 [
thru "Height: "
copy height
to "^/"
(print ["Height: " height])
thru "^/"]
0 1 [
thru "Eyes: "
copy Eyes
to "^/"
(print ["Eyes: " Eyes])
thru "^/"]
0 1 [
thru "Hair: "
copy Hair
to "^/"
(print ["Hair: " hair])
thru "^/"]
0 1 [
thru "Hobbies: "
copy Hobbies
to "^/"
(print ["Hobbies: " Hobbies])
thru "^/"]
thru "Book: "
copy book
to "^/"
(print ["Book: " book])
thru "^/"
thru "1stPubblication: "
copy first_publ
to "^/"
(print ["1stPubblication: " first_publ])
thru "^/"
thru "Brief description: "
copy brief_descr
to "^/"
(print ["Brief description: " brief_descr])
thru "^/"
]
print ""
print "Parsing example1"
print "================"
print parse/all example1 rule
print ""
print "Parsing example2"
print "================"
print parse/all example2 rule
halt
=========================================== end of script
============================================
Giuseppe Chillemi wrote:
>Is there a way to conditionally parse a String in only one run ? The target
>of this question if to find a way to PARSE in one command a text page which
>could have data formatted in different way or new data in certain situation.
>
>
>
>Here is an example:
>
>
>
>This is the usual page:
>
>
>
>Name: John
>
>Surname: Doe
>
>Book: Private America
>
>1stPubblication: 1950
>
>Brief description: oo xx oo xx oo xx
>
>
>
>Name: John2
>
>Surname: Doe2
>
>Book: Private America2
>
>1stPubblication: 1950
>
>Brief description: oo xx oo xx oo xx 2
>
>
>
>Name: John3
>
>Surname: Doe3
>
>Book: Private America3
>
>1stPubblication: 1950
>
>Brief description: oo xx oo xx oo xx 3
>
>
>
>This is the same page with differences:
>
>
>
>Name: John
>
>Surname: Doe
>
>Book: Private America
>
>1stPubblication: 1950
>
>Brief description: oo xx oo xx oo xx
>
>
>
>(Here is the difference. This Is a comment, consider it as non existent)
>
>
>
>Name: Jane
>
>Surname: Doe
>
>Height: 1.75m
>
>Eyes: Brown
>
>Hair: Blonde
>
>Hobbies: Play Tennis, Swim, Music
>
>Book: Private Women of America
>
>1stPubblication: 1950
>
>Brief description: oo xx oo xx oo xx Woman
>
>
>
>Name: John2
>
>Surname: Doe2
>
>Book: Private America2
>
>1stPubblication: 1950
>
>Brief description: oo xx oo xx oo xx 2
>
>
>
>
>
> Thank you in advance.
>
>
>
> Giuseppe Chillemi
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.