Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Repeat pattern Re:(2)

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 Unix.............: Metamail Windows/Macintosh: Eudora General info about MIME can be found at: --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 ? > > ----- Message d'origine ----- > De : <[jsc--dataheaven--de]> > =C0 : <[list--rebol--com]> > Envoy=E9 : dimanche 1 octobre 2000 19:53 > Objet : [REBOL] Repeat pattern Re: > >> 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) >> ] >> ] >> >
--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--