Repeat pattern
[1/4] from: youpi:technologies:wanadoo at: 1-Oct-2000 15:03
Let suppose this rule:
12 [thru "<table>" copy text to "</table>"]
How to modify the syntax if you want to do it not 12 times but only the 12th
time ?
Thanks
[2/4] from: jsc:dataheaven at: 1-Oct-2000 19:53
On Sun, 01 Oct 2000, you wrote:
> Let suppose this rule:
> 12 [thru "<table>" copy text to "</table>"]
>
> How to modify the syntax if you want to do it not 12 times but only the
> 12th time ?
Not tested but...
counter: 0
tables: []
parse mypage [some [thru "<table> copy text to "</table>"
(if (counter // 12) = 0 [append tables text]
counter: counter + 1)
]
]
[3/4] from: youpi::technologies::wanadoo::fr at: 1-Oct-2000 22:58
Thanks but if you don't want copy text between 1 and 11 but only on the 12th
is it possible ?
----- Message d'origine -----
De : <[jsc--dataheaven--de]>
À : <[list--rebol--com]>
Envoyé : dimanche 1 octobre 2000 19:53
Objet : [REBOL] Repeat pattern Re:
[4/4] from: rebol:svendx:dk at: 2-Oct-2000 0:03
Warning: This is a message in MIME format. Your mail reader does not
support MIME. Some parts of this message will be readable as plain text.
To see the rest, you will need to upgrade your mail reader. Following are
some URLs where you can find MIME-capable mail programs for common platforms:
Amiga............: YAM http://www.yam.ch/
Unix.............: Metamail ftp://ftp.bellcore.com/nsb/
Windows/Macintosh: Eudora http://www.qualcomm.com/
General info about MIME can be found at:
http://www.cis.ohio-state.edu/hypertext/faq/usenet/mail/mime-faq/top.html
--BOUNDARY.147462800.1
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Hello [youpi--technologies--wanadoo--fr],
Try this:
REBOL []
table-rule: [thru "<table>"]
table-rule-copy: [thru "<table>" copy text to "</table>"]
tables-rule: [
11 table-rule
1 table-rule-copy
to end
]
parse read %test.html tables-rule
print text
a test file is attached.
Note that if you'd like to handle stuff like "<table border=0>", you'd need to modify
the rules a bit:
(not testet)
table-rule: [thru "<table"]
table-rule-copy: [thru "<table" thru ">" copy text to "</table>"]
Best regards
Thomas Jensen
On 01-Oct-00, [youpi--technologies--wanadoo--fr] wrote:
> Thanks but if you don't want copy text between 1 and 11 but only on the 12th
> is it possible ?
<<quoted lines omitted: 21>>
>> ]
>>
--BOUNDARY.147462800.1
Content-Type: text/html; name="test.html"
Content-Disposition: attachment; filename="test.html"
<html>
<head></head>
<body>
<table><tr><td>test01</tr></td></table>
<table><tr><td>test02</tr></td></table>
<table><tr><td>test03</tr></td></table>
<table><tr><td>test04</tr></td></table>
<table><tr><td>test05</tr></td></table>
<table><tr><td>test06</tr></td></table>
<table><tr><td>test07</tr></td></table>
<table><tr><td>test08</tr></td></table>
<table><tr><td>test09</tr></td></table>
<table><tr><td>test10</tr></td></table>
<table><tr><td>test11</tr></td></table>
<table><tr><td>test12</tr></td></table>
<table><tr><td>test13</tr></td></table>
</body>
</html>
--BOUNDARY.147462800.1--
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted